Add servers/ips api_samples tests

Change-Id: I65f8b53b4126458e1522f0bc47559dc1318a473a
This commit is contained in:
Dan Smith 2012-09-25 09:40:46 -07:00
parent e1295a2072
commit e788d7694d
9 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,8 @@
{
"private": [
{
"addr": "192.168.0.3",
"version": 4
}
]
}

View File

@ -0,0 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<network xmlns="http://docs.openstack.org/compute/api/v1.1" id="private">
<ip version="4" addr="192.168.0.3"/>
</network>

View File

@ -0,0 +1,10 @@
{
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"version": 4
}
]
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<addresses xmlns="http://docs.openstack.org/compute/api/v1.1">
<network id="private">
<ip version="4" addr="192.168.0.3"/>
</network>
</addresses>

View File

@ -0,0 +1,8 @@
{
"private": [
{
"addr": "%(ip)s",
"version": 4
}
]
}

View File

@ -0,0 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<network xmlns="http://docs.openstack.org/compute/api/v1.1" id="private">
<ip version="4" addr="%(ip)s"/>
</network>

View File

@ -0,0 +1,10 @@
{
"addresses": {
"private": [
{
"addr": "%(ip)s",
"version": 4
}
]
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<addresses xmlns="http://docs.openstack.org/compute/api/v1.1">
<network id="private">
<ip version="4" addr="%(ip)s"/>
</network>
</addresses>

View File

@ -377,6 +377,26 @@ class ServersMetadataXmlTest(ServersMetadataJsonTest):
ctype = 'xml'
class ServersIpsJsonTest(ServersSampleBase):
def test_get(self):
"""Test getting a server's IP information"""
uuid = self._post_server()
response = self._do_get('servers/%s/ips' % uuid)
subs = self._get_regexes()
return self._verify_response('server-ips-resp', subs, response)
def test_get_by_network(self):
"""Test getting a server's IP information by network id"""
uuid = self._post_server()
response = self._do_get('servers/%s/ips/private' % uuid)
subs = self._get_regexes()
return self._verify_response('server-ips-network-resp', subs, response)
class ServersIpsXmlTest(ServersIpsJsonTest):
ctype = 'xml'
class ExtensionsSampleJsonTest(ApiSampleTestBase):
all_extensions = True