tests/vcloud_director/requests/compute/network_tests.rb in fog-maestrodev-1.18.0.20131209091424 vs tests/vcloud_director/requests/compute/network_tests.rb in fog-maestrodev-1.18.0.20131218202447

- old
+ new

@@ -5,11 +5,11 @@ :name => String, :href => String, :id => String, :description => Fog::Nullable::String, :is_inherited => Fog::Boolean, - :gateway => String, + :gateway => Fog::Nullable::String, :netmask => String, :dns1 => Fog::Nullable::String, :dns2 => Fog::Nullable::String, :dns_suffix => Fog::Nullable::String, :ip_ranges => [{ @@ -19,10 +19,18 @@ } @service = Fog::Compute::VcloudDirector.new @org = VcloudDirector::Compute::Helper.current_org(@service) + tests('Create network in non-existent vDC').raises(Fog::Compute::VcloudDirector::Forbidden) do + @service.post_create_org_vdc_network('00000000-0000-0000-0000-000000000000', 'bob') + end + + tests('Delete non-existent OrgNetwork').raises(Fog::Compute::VcloudDirector::Forbidden) do + @service.delete_network('00000000-0000-0000-0000-000000000000') + end + tests('#get_network').data_matches_schema(GET_NETWORK_FORMAT) do link = @org[:Link].detect do |l| l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.orgNetwork+xml' end pending unless link # nothing to test here cannot continue @@ -36,8 +44,24 @@ @service.get_network_metadata(@network_id).body end tests('Retrieve non-existent OrgNetwork').raises(Fog::Compute::VcloudDirector::Forbidden) do @service.get_network('00000000-0000-0000-0000-000000000000') + end + + # at the moment just test delete_network in Mock mode, until we have + # ability to create a test one in Real mode + if Fog.mocking? + # TODO replace with a Query API lookup when available + net_id = @service.data[:networks].keys.first + @delete_task = @service.delete_network(net_id).body + tests('#delete_network returns Task').data_matches_schema(VcloudDirector::Compute::Schema::TASK_TYPE) do + @delete_task + end + @service.process_task(@delete_task) + tests('#delete_network succeeds').returns(nil) do + # network missing now? + net_id = @service.data[:networks][net_id] + end end end