Merge servers-ips functional tests of v2 and v2.1

Currently v2 and v2.1 have separate functional tests and their
corresponding sample files. As v2 and v2.1 are supposed to be identical,
there is overhead to maintain two set of functional tests and sample files.
We can have one set of tests which can run for both v2 and v2.1.

This commit merges servers-ips functional tests.

Change-Id: I60d470997e369154550516d5f02fffb0d846620b
This commit is contained in:
parklong 2015-04-16 15:59:57 +08:00
parent f713c7c7b5
commit 83c52f6650
6 changed files with 11 additions and 54 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -318,24 +318,6 @@ class ServersMetadataJsonTest(ServersSampleBase):
self.assertEqual(response.content, '')
class ServersIpsJsonTest(ServersSampleBase):
sample_dir = 'servers'
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()
self._verify_response('server-ips-resp', subs, response, 200)
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()
self._verify_response('server-ips-network-resp', subs, response, 200)
class ExtensionsSampleJsonTest(ApiSampleTestBaseV2):
all_extensions = True

View File

@ -13,12 +13,23 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class ServersIpsJsonTest(test_servers.ServersSampleBase):
extends_name = 'core_only'
sample_dir = 'server-ips'
extra_extensions_to_load = ["os-access-ips"]
# TODO(park): Overriding '_api_version' till all functional tests
# are merged between v2 and v2.1. After that base class variable
# itself can be changed to 'v2'
_api_version = 'v2'
def test_get(self):
# Test getting a server's IP information.