1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/vcloud_director/requests/compute/network_tests.rb
Nick Osborn 7a1d4e5075 [vcloud_director] Raise provider-specific exceptions.
HEADS UP: This is a breaking change for anyone rescuing Excon errors.
2013-10-14 01:10:19 +01:00

41 lines
1.3 KiB
Ruby

Shindo.tests('Compute::VcloudDirector | network requests', ['vclouddirector']) do
GET_NETWORK_FORMAT = {
:type => String,
:name => String,
:href => String,
:id => String,
:description => Fog::Nullable::String,
:is_inherited => Fog::Boolean,
:gateway => String,
:netmask => String,
:dns1 => Fog::Nullable::String,
:dns2 => Fog::Nullable::String,
:dns_suffix => Fog::Nullable::String,
:ip_ranges => [{
:start_address => String,
:end_address => String
}]
}
@service = Fog::Compute::VcloudDirector.new
@org = VcloudDirector::Compute::Helper.current_org(@service)
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
@network_id = link[:href].split('/').last
@service.get_network(@network_id).body
end
tests('#get_network_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do
pending if Fog.mocking?
@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
end