mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
added associate_floatingip and disassosiate_floatingip mock test
This commit is contained in:
parent
8329f16f8d
commit
a4abfa3118
4 changed files with 19121 additions and 7 deletions
|
@ -52,15 +52,14 @@ module Fog
|
|||
requires :floating_network_id
|
||||
merge_attributes(connection.assosiate_floatingip(self.floating_network_id,
|
||||
self.port_id,
|
||||
self.fixed_ip_address,
|
||||
self.attributes).body['floatingip'])
|
||||
true
|
||||
self
|
||||
end
|
||||
|
||||
def disassosiate
|
||||
requires :floating_network_id
|
||||
connection.disassosiate_floatingip(self.floating_network_id)
|
||||
true
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,14 +3,15 @@ module Fog
|
|||
class OpenStack
|
||||
|
||||
class Real
|
||||
def associate_floatingip(floating_network_id, options = {})
|
||||
def associate_floatingip(floating_network_id, port_id, options = {})
|
||||
data = {
|
||||
'floatingip' => {
|
||||
'network_id' => floating_network_id,
|
||||
'port_id' => port_id,
|
||||
}
|
||||
}
|
||||
|
||||
vanilla_options = [:port_id, :fixed_ip_address ]
|
||||
vanilla_options = [:fixed_ip_address]
|
||||
vanilla_options.reject{ |o| options[o].nil? }.each do |key|
|
||||
data['floatingip'][key] = options[key]
|
||||
end
|
||||
|
@ -25,7 +26,7 @@ module Fog
|
|||
end
|
||||
|
||||
class Mock
|
||||
def associatee_floatingip(floating_network_id, options = {})
|
||||
def associate_floatingip(floating_network_id, port_id, options = {})
|
||||
response = Excon::Response.new
|
||||
response.status = 201
|
||||
data = {
|
||||
|
|
|
@ -40,9 +40,20 @@ Shindo.tests('Fog::Network[:openstack] | floatingip requests', ['openstack']) do
|
|||
Fog::Network[:openstack].update_floatingip(floating_network_id, attributes).body
|
||||
end
|
||||
|
||||
tests('#associate_floatingip').succeeds do
|
||||
floating_network_id = Fog::Network[:openstack].floatingips.all.first.id
|
||||
port_id = 'p00000000-0000-0000-0000-000000000000'
|
||||
Fog::Network[:openstack].associate_floatingip(floating_network_id, port_id).body
|
||||
end
|
||||
|
||||
tests('#disassociate_floatingip').succeeds do
|
||||
floating_network_id = Fog::Network[:openstack].floatingips.all.first.id
|
||||
Fog::Network[:openstack].disassociate_floatingip(floating_network_id).body
|
||||
end
|
||||
|
||||
tests('#delete_floatingip').succeeds do
|
||||
floating_network_id = Fog::Network[:openstack].floatingips.all.first.id
|
||||
Fog::Network[:openstack].delete_floatingip(floating_network_id)
|
||||
Fog::Network[:openstack].delete_floatingip(floating_network_id).body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue