Merge "Makes GET extension info sample tests run for v2 also"

This commit is contained in:
Jenkins 2016-01-05 04:56:58 +00:00 committed by Gerrit Code Review
commit 73ce34ad61
5 changed files with 35 additions and 13 deletions

View File

@ -0,0 +1,10 @@
{
"extension": {
"alias": "os-agents",
"description": "Agents support.",
"links": [],
"name": "Agents",
"namespace": "http://docs.openstack.org/compute/ext/agents/api/v2",
"updated": "2012-10-28T00:00:00Z"
}
}

View File

@ -1,9 +1,9 @@
{
"extension": {
"alias": "os-create-backup",
"description": "Create a backup of a server.",
"alias": "os-agents",
"description": "Agents support.",
"links": [],
"name": "CreateBackup",
"name": "Agents",
"namespace": "http://docs.openstack.org/compute/ext/fake_xml",
"updated": "2014-12-03T00:00:00Z"
}

View File

@ -0,0 +1,10 @@
{
"extension": {
"alias": "os-agents",
"description": "%(text)s",
"links": [],
"name": "Agents",
"namespace": "http://docs.openstack.org/compute/ext/agents/api/v2",
"updated": "%(isotime)s"
}
}

View File

@ -1,9 +1,9 @@
{
"extension": {
"alias": "os-create-backup",
"description": "Create a backup of a server.",
"alias": "os-agents",
"description": "Agents support.",
"links": [],
"name": "CreateBackup",
"name": "Agents",
"namespace": "http://docs.openstack.org/compute/ext/fake_xml",
"updated": "2014-12-03T00:00:00Z"
}

View File

@ -52,15 +52,17 @@ class ExtensionInfoAllSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
class ExtensionInfoSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
sample_dir = "extension-info"
extra_extensions_to_load = ["os-create-backup"]
# NOTE (gmann): run this tests for v21. and v2.1 compatible mode only
# as there is no 'extensions/*' API in v2.
scenarios = [('v2_1', {'_test': 'v2.1'}),
('v2_1_compatible', {'_test': 'v2.1_compatible'})]
all_extensions = True
@mock.patch.object(api_extensions, 'os_compute_soft_authorizer')
def test_get_extensions(self, soft_auth):
soft_auth.side_effect = fake_soft_extension_authorizer
response = self._do_get('extensions/os-create-backup')
response = self._do_get('extensions/os-agents')
subs = self._get_regexes()
self._verify_response('extensions-get-resp', subs, response, 200)
# The extension details info are different between legacy v2 and v2.1
# stack. namespace link and updated date are different. So keep both
# version for testing and default to v2.1
template = 'extensions-get-resp'
if self._legacy_v2_code:
template = 'extensions-get-resp-v2'
self._verify_response(template, subs, response, 200)