diff --git a/doc/api_samples/os-floating-ip-pools/floatingippools-list-resp.json b/doc/api_samples/os-floating-ip-pools/floatingippools-list-resp.json new file mode 100644 index 000000000000..7b648298758d --- /dev/null +++ b/doc/api_samples/os-floating-ip-pools/floatingippools-list-resp.json @@ -0,0 +1,10 @@ +{ + "floating_ip_pools": [ + { + "name": "pool1" + }, + { + "name": "pool2" + } + ] +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-pools/floatingippools-list-resp.xml b/doc/api_samples/os-floating-ip-pools/floatingippools-list-resp.xml new file mode 100644 index 000000000000..ca09fbf955de --- /dev/null +++ b/doc/api_samples/os-floating-ip-pools/floatingippools-list-resp.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nova/tests/integrated/api_samples/os-floating-ip-pools/floatingippools-list-resp.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-pools/floatingippools-list-resp.json.tpl new file mode 100644 index 000000000000..607109d70d34 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-pools/floatingippools-list-resp.json.tpl @@ -0,0 +1,10 @@ +{ + "floating_ip_pools": [ + { + "name": "%(pool1)s" + }, + { + "name": "%(pool2)s" + } + ] +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-pools/floatingippools-list-resp.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-pools/floatingippools-list-resp.xml.tpl new file mode 100644 index 000000000000..ae4b3a4bb38b --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-pools/floatingippools-list-resp.xml.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 887ca206f25b..4134a7cf6286 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -379,7 +379,6 @@ class ApiSamplesTrap(ApiSampleTestBase): do_not_approve_additions.append('os-flavor-access') do_not_approve_additions.append('os-flavor-extra-specs') do_not_approve_additions.append('os-floating-ip-dns') - do_not_approve_additions.append('os-floating-ip-pools') do_not_approve_additions.append('os-fping') do_not_approve_additions.append('os-hypervisors') do_not_approve_additions.append('os-instance_usage_audit_log') @@ -2662,3 +2661,30 @@ class BareMetalNodesJsonTest(ApiSampleTestBase, bm_db_base.BMDBTestCase): class BareMetalNodesXmlTest(BareMetalNodesJsonTest): ctype = 'xml' + + +class FloatingIPPoolsSampleJsonTests(ApiSampleTestBase): + extension_name = ("nova.api.openstack.compute.contrib.floating_ip_pools." + "Floating_ip_pools") + + def test_list_floatingippools(self): + pool_list = ["pool1", "pool2"] + + def fake_get_floating_ip_pools(self, context): + return [{'name': pool_list[0]}, + {'name': pool_list[1]}] + + self.stubs.Set(network_api.API, "get_floating_ip_pools", + fake_get_floating_ip_pools) + response = self._do_get('os-floating-ip-pools') + self.assertEqual(response.status, 200) + subs = { + 'pool1': pool_list[0], + 'pool2': pool_list[1] + } + return self._verify_response('floatingippools-list-resp', + subs, response) + + +class FloatingIPPoolsSampleXmlTests(FloatingIPPoolsSampleJsonTests): + ctype = "xml"