Added sample tests to floating-ip-pools API.

Partially implements blueprint nova-api-samples
Fixes bug 1070165

Change-Id: Ia7d99354ae815cdd8a41b012f568877751a3d8bd
This commit is contained in:
Giampaolo Lauria 2013-01-23 14:18:31 -05:00
parent 13290fdb99
commit adbfd0da94
5 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,10 @@
{
"floating_ip_pools": [
{
"name": "pool1"
},
{
"name": "pool2"
}
]
}

View File

@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<floating_ip_pools>
<floating_ip_pool name="pool1"/>
<floating_ip_pool name="pool2"/>
</floating_ip_pools>

View File

@ -0,0 +1,10 @@
{
"floating_ip_pools": [
{
"name": "%(pool1)s"
},
{
"name": "%(pool2)s"
}
]
}

View File

@ -0,0 +1,4 @@
<floating_ip_pools>
<floating_ip_pool name="%(pool1)s"/>
<floating_ip_pool name="%(pool2)s"/>
</floating_ip_pools>

View File

@ -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"