1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/requests/compute/release_address.rb
Dan Prince 1bfc49fa71 OpenStack floating_ip (aka address) test fixes
Updates to the OpenStack address tests so that:

 * The tests cleanup after themselves when executed in Real mode.
   Previously running these tests in Real mode would leak servers
   and floating IPs.

 * DRY things up a bit.

 * Make use of the floating IP we create in subsequent tests. Previously
   the last floating IP in the full list was used. This could be
   problematic in some cases.

--

Also adds a missing Mock class for the release_address request so
that FOG_MOCK tests continue to pass.
2012-11-28 22:04:09 -05:00

34 lines
682 B
Ruby

module Fog
module Compute
class OpenStack
class Real
def release_address(address_id)
request(
:expects => [200, 202],
:method => 'DELETE',
:path => "os-floating-ips/#{address_id}"
)
end
end
class Mock
def release_address(address_id)
response = Excon::Response.new
response.status = 202
response.headers = {
"Content-Type" => "text/html; charset=UTF-8",
"Content-Length" => "0",
"Date" => Date.new
}
response.body = {}
response
end
end # mock
end
end
end