1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/glesys/requests/compute/ip_tests.rb

68 lines
1.8 KiB
Ruby
Raw Normal View History

2011-09-08 16:41:21 -04:00
Shindo.tests('Fog::Compute[:glesys] | ip requests', ['glesys']) do
2011-08-17 11:53:20 -04:00
@free_ip = nil
@ips = nil
tests('success') do
tests("#ip_list_own()").formats(Glesys::Compute::Formats::Ips::IPLIST) do
pending if Fog.mocking?
2011-09-08 16:41:21 -04:00
Fog::Compute[:glesys].ip_list_own.body['response']
2011-08-17 11:53:20 -04:00
end
tests("#ip_list_free(:datacenter => 'Falkenberg, :platform => 'Xen', :ipversion => 4)"
2011-08-17 11:53:20 -04:00
).formats(Glesys::Compute::Formats::Ips::IPLIST_ALL) do
pending if Fog.mocking?
2011-09-08 16:41:21 -04:00
ips = Fog::Compute[:glesys].ip_list_free(
2011-08-17 11:53:20 -04:00
:datacenter => "Falkenberg",
:platform => "Xen",
:ipversion => 4
)
@free_ip = ips.body['response']['iplist']['ipaddresses'].first
2011-08-17 11:53:20 -04:00
ips.body['response']
end
2011-08-17 11:53:20 -04:00
tests("#ip_take(:datacenter => 'Falkenberg', :platform => 'Xen', :ipversion => 4, :ipaddress => #{@free_ip})"
).formats(Glesys::Compute::Formats::Ips::IPLIST_CATCH_RELEASE) do
pending if Fog.mocking?
2011-09-08 16:41:21 -04:00
Fog::Compute[:glesys].ip_take(
2011-08-17 11:53:20 -04:00
:datacenter => "Falkenberg",
:platform => "Xen",
:ipversion => 4,
:ipaddress => @free_ip
).body['response']
end
tests("#ip_release(:ipaddress => '#{@free_ip}', :ipversion => 4)"
).formats(Glesys::Compute::Formats::Ips::IPLIST_CATCH_RELEASE) do
pending if Fog.mocking?
2011-09-08 16:41:21 -04:00
Fog::Compute[:glesys].ip_release(
2011-08-17 11:53:20 -04:00
:ipaddress => @free_ip,
:ipversion => 4
).body['response']
end
# ip_details()
# ip_add()
# ip_remove()
end
tests('failure') do
tests("#ip_take_argument_error()").raises(Excon::Errors::HTTPStatusError) do
pending if Fog.mocking?
2011-09-08 16:41:21 -04:00
ip = Fog::Compute[:glesys].ips.new(
2011-08-17 11:53:20 -04:00
:datacenter => "Falkenberg",
:platform => "Xen",
:version => 4,
:ip => "127.0.0.1"
)
ip.take
end
end
end