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

40 lines
1.2 KiB
Ruby

Shindo.tests('Rackspace::Compute | address requests', ['rackspace']) do
tests('success') do
@server = Rackspace[:compute].servers.create(:flavor_id => 1, :image_id => 19)
tests("#list_addresses(#{@server.id})").formats({'addresses' => {'private' => [String], 'public' => [String]}}) do
Rackspace[:compute].list_addresses(@server.id).body
end
tests("#list_private_addresses(#{@server.id})").formats({'private' => [String]}) do
Rackspace[:compute].list_private_addresses(@server.id).body
end
tests("#list_public_addresses(#{@server.id})").formats({'public' => [String]}) do
Rackspace[:compute].list_public_addresses(@server.id).body
end
@server.wait_for { ready? }
@server.destroy
end
tests('failure') do
tests('#list_addresses(0)').raises(Fog::Rackspace::Compute::NotFound) do
Rackspace[:compute].list_addresses(0)
end
tests('#list_private_addresses(0)').raises(Fog::Rackspace::Compute::NotFound) do
Rackspace[:compute].list_private_addresses(0)
end
tests('#list_public_addresses(0)').raises(Fog::Rackspace::Compute::NotFound) do
Rackspace[:compute].list_public_addresses(0)
end
end
end