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

43 lines
1.4 KiB
Ruby
Raw Normal View History

2011-06-22 18:08:38 -04:00
Shindo.tests('Fog::Compute[:ninefold] | address requests', ['ninefold']) do
tests('success') do
tests("#associate_ip_address()").formats(Ninefold::Compute::Formats::Addresses::ADDRESS) do
pending if Fog.mocking?
job = newaddress = Fog::Compute[:ninefold].associate_ip_address(:zoneid => Ninefold::Compute::TestSupport::ZONE_ID)
while Fog::Compute[:ninefold].query_async_job_result(:jobid => job['jobid'])['jobstatus'] == 0
sleep 1
end
result = Fog::Compute[:ninefold].query_async_job_result(:jobid => job['jobid'])['jobresult']['ipaddress']
@newaddressid = result['id']
2011-06-22 18:08:38 -04:00
result
end
tests("#list_public_ip_addresses()").formats(Ninefold::Compute::Formats::Addresses::ADDRESSES) do
pending if Fog.mocking?
result = Fog::Compute[:ninefold].list_public_ip_addresses
2011-06-22 18:08:38 -04:00
result
end
tests("#disassociate_ip_address()").formats(Ninefold::Compute::Formats::Addresses::DISASSOC_ADDRESS) do
pending if Fog.mocking?
job = Fog::Compute[:ninefold].disassociate_ip_address(:id => @newaddressid)
while Fog::Compute[:ninefold].query_async_job_result(:jobid => job['jobid'])['jobstatus'] == 0
sleep 1
end
job
end
end
tests('failure') do
tests("#associate_ip_address()").raises(Excon::Errors::HTTPStatusError) do
pending if Fog.mocking?
Fog::Compute[:ninefold].associate_ip_address
end
end
end