Adds V3 API specific urlmap tests
Adds V3 API versions of the urlmap unittests. These test that the V3 content is returned when expected in the format expected. Adds the extension plugin as being discoverage in the fake policy files for the unitests to provide some easily known data to check for the urlmap tests. Updates extension info api sample tests Partially implements v3-api-unittests Change-Id: I67f2a3516ffee02b6dbf258ee35e1fd084ba060c
This commit is contained in:
parent
ff430b6a3f
commit
822ca02b83
@ -1,5 +1,12 @@
|
||||
{
|
||||
"extensions": [
|
||||
{
|
||||
"alias": "extensions",
|
||||
"description": "Extension information.",
|
||||
"name": "extensions",
|
||||
"namespace": "http://docs.openstack.org/compute/core/extension_info/api/v3",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"alias": "flavors",
|
||||
"description": "Flavors Extension.",
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<extensions xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/common/api/v1.0">
|
||||
<extension alias="extensions" version="1" namespace="http://docs.openstack.org/compute/core/extension_info/api/v3" name="extensions">
|
||||
<description>Extension information.</description>
|
||||
</extension>
|
||||
<extension alias="flavors" version="1" namespace="http://docs.openstack.org/compute/core/flavors/v3" name="flavors">
|
||||
<description>Flavors Extension.</description>
|
||||
</extension>
|
||||
|
@ -116,3 +116,56 @@ class UrlmapTest(test.NoDBTestCase):
|
||||
body = jsonutils.loads(res.body)
|
||||
self.assertEqual(body['image']['id'],
|
||||
'cedef40a-ed67-4d10-800e-17455edce175')
|
||||
|
||||
def test_path_version_v3(self):
|
||||
# Test URL path specifying v3 returns v3 content.
|
||||
req = webob.Request.blank('/v3/')
|
||||
req.accept = "application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v3(init_only=('versions',)))
|
||||
self.assertEqual(res.status_int, 200)
|
||||
self.assertEqual(res.content_type, "application/json")
|
||||
body = jsonutils.loads(res.body)
|
||||
self.assertEqual(body['version']['id'], 'v3.0')
|
||||
|
||||
def test_content_type_version_v3(self):
|
||||
# Test Content-Type specifying v3 returns v3 content.
|
||||
req = webob.Request.blank('/')
|
||||
req.content_type = "application/json;version=3"
|
||||
req.accept = "application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v3(init_only=('versions',)))
|
||||
self.assertEqual(res.status_int, 200)
|
||||
self.assertEqual(res.content_type, "application/json")
|
||||
body = jsonutils.loads(res.body)
|
||||
self.assertEqual(body['version']['id'], 'v3.0')
|
||||
|
||||
def test_accept_version_v3(self):
|
||||
# Test Accept header specifying v3 returns v3 content.
|
||||
req = webob.Request.blank('/')
|
||||
req.accept = "application/json;version=3"
|
||||
res = req.get_response(fakes.wsgi_app_v3(init_only=('versions',)))
|
||||
self.assertEqual(res.status_int, 200)
|
||||
self.assertEqual(res.content_type, "application/json")
|
||||
body = jsonutils.loads(res.body)
|
||||
self.assertEqual(body['version']['id'], 'v3.0')
|
||||
|
||||
def test_path_content_type_v3(self):
|
||||
# Test URL path specifying JSON returns JSON content.
|
||||
url = '/v3/extensions/extensions.json'
|
||||
req = webob.Request.blank(url)
|
||||
req.accept = "application/xml"
|
||||
res = req.get_response(fakes.wsgi_app_v3())
|
||||
self.assertEqual(res.status_int, 200)
|
||||
self.assertEqual(res.content_type, "application/json")
|
||||
body = jsonutils.loads(res.body)
|
||||
self.assertEqual(body['extension']['name'], 'extensions')
|
||||
|
||||
def test_accept_content_type_v3(self):
|
||||
# Test Accept header specifying JSON returns JSON content.
|
||||
url = '/v3/extensions/extensions'
|
||||
req = webob.Request.blank(url)
|
||||
req.accept = "application/xml;q=0.8, application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v3(init_only=('extensions',)))
|
||||
self.assertEqual(res.status_int, 200)
|
||||
self.assertEqual(res.content_type, "application/json")
|
||||
body = jsonutils.loads(res.body)
|
||||
self.assertEqual(body['extension']['name'], 'extensions')
|
||||
|
@ -170,6 +170,7 @@ policy_data = """
|
||||
"compute_extension:v3:os-extended-volumes:swap": "",
|
||||
"compute_extension:v3:os-extended-volumes:attach": "",
|
||||
"compute_extension:v3:os-extended-volumes:detach": "",
|
||||
"compute_extension:v3:extensions:discoverable": "",
|
||||
"compute_extension:fixed_ips": "",
|
||||
"compute_extension:flavor_access": "",
|
||||
"compute_extension:v3:os-flavor-access": "",
|
||||
|
@ -1,5 +1,12 @@
|
||||
{
|
||||
"extensions": [
|
||||
{
|
||||
"alias": "extensions",
|
||||
"description": "Extension information.",
|
||||
"name": "extensions",
|
||||
"namespace": "http://docs.openstack.org/compute/core/extension_info/api/v3",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"alias": "flavors",
|
||||
"description": "Flavors Extension.",
|
||||
@ -8,4 +15,4 @@
|
||||
"version": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<extensions xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/common/api/v1.0">
|
||||
<extension alias="extensions" version="1" namespace="http://docs.openstack.org/compute/core/extension_info/api/v3" name="extensions">
|
||||
<description>Extension information.</description>
|
||||
</extension>
|
||||
<extension alias="flavors" version="1" namespace="http://docs.openstack.org/compute/core/flavors/v3" name="flavors">
|
||||
<description>Flavors Extension.</description>
|
||||
</extension>
|
||||
</extensions>
|
||||
</extensions>
|
Loading…
x
Reference in New Issue
Block a user