From f969453c5e23aa553f22d3d38b8a33f128b58824 Mon Sep 17 00:00:00 2001 From: Ferran Rodenas Date: Wed, 22 May 2013 16:41:59 +0200 Subject: [PATCH] [openstack|compute] Add mock method to list_address_pools --- .../openstack/requests/compute/list_address_pools.rb | 10 ++++++++++ tests/openstack/requests/compute/address_tests.rb | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/fog/openstack/requests/compute/list_address_pools.rb b/lib/fog/openstack/requests/compute/list_address_pools.rb index ad3b276cd..cfc75fc5c 100644 --- a/lib/fog/openstack/requests/compute/list_address_pools.rb +++ b/lib/fog/openstack/requests/compute/list_address_pools.rb @@ -16,6 +16,16 @@ module Fog class Mock + def list_address_pools + response = Excon::Response.new + response.status = 200 + response.body = { + 'floating_ip_pools' => [ + { 'name' => 'nova' } + ] + } + response + end end end diff --git a/tests/openstack/requests/compute/address_tests.rb b/tests/openstack/requests/compute/address_tests.rb index 85031b4f8..3d02404a2 100644 --- a/tests/openstack/requests/compute/address_tests.rb +++ b/tests/openstack/requests/compute/address_tests.rb @@ -12,6 +12,10 @@ Shindo.tests('Fog::Compute[:openstack] | address requests', ['openstack']) do "pool" => String } + @address_pools_format = { + "name" => String + } + tests('success') do tests('#allocate_address').formats({"floating_ip" => @address_format}) do @@ -29,6 +33,10 @@ Shindo.tests('Fog::Compute[:openstack] | address requests', ['openstack']) do compute.get_address(@address_id).body end + tests('#list_address_pools').formats({"floating_ip_pools" => [@address_pools_format]}) do + compute.list_address_pools.body + end + compute.servers.get(@server_id).wait_for { ready? } tests('#associate_address(server_id, ip_address)').succeeds do