Remove unused init_only kwarg from wsgi app init
Since d8673cb256
the init_only
kwarg is no longer used in the compute API wsgi app setup.
This patch removes it along with it's usage throughout the
compute REST API unit tests where it was used to isolate
testing of extensions, which is not valid anymore as all
extensions are enabled and we removed the ability to
whitelist/blacklist them.
Change-Id: I2f58b7944d0f7d7c05683238474954a65a617ec3
This commit is contained in:
parent
a74d3ae4e8
commit
46923c7cc9
|
@ -221,7 +221,7 @@ class APIRouterV21(base_wsgi.Router):
|
|||
def api_extension_namespace():
|
||||
return 'nova.api.v21.extensions'
|
||||
|
||||
def __init__(self, init_only=None):
|
||||
def __init__(self):
|
||||
def _check_load_extension(ext):
|
||||
return self._register_extension(ext)
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ class APIRouterV21(nova.api.openstack.APIRouterV21):
|
|||
"""Routes requests on the OpenStack API to the appropriate controller
|
||||
and method.
|
||||
"""
|
||||
def __init__(self, init_only=None):
|
||||
def __init__(self):
|
||||
self._loaded_extension_info = extension_info.LoadedExtensionInfo()
|
||||
super(APIRouterV21, self).__init__(init_only)
|
||||
super(APIRouterV21, self).__init__()
|
||||
|
||||
def _register_extension(self, ext):
|
||||
return self.loaded_extension_info.register_extension(ext.obj)
|
||||
|
|
|
@ -33,7 +33,7 @@ class APITest(test.NoDBTestCase):
|
|||
|
||||
@property
|
||||
def wsgi_app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('versions',))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def _wsgi_app(self, inner_app):
|
||||
return openstack_api.FaultWrapper(inner_app)
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfigDriveTestV21(test.TestCase):
|
|||
base_url = '/v2/fake/servers/'
|
||||
|
||||
def _setup_wsgi(self):
|
||||
self.app = fakes.wsgi_app_v21(init_only=('servers', 'os-config-drive'))
|
||||
self.app = fakes.wsgi_app_v21()
|
||||
|
||||
def setUp(self):
|
||||
super(ConfigDriveTestV21, self).setUp()
|
||||
|
|
|
@ -88,8 +88,7 @@ class ExtendedAvailabilityZoneTestV21(test.TestCase):
|
|||
def _make_request(self, url):
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.headers['Accept'] = self.content_type
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=(
|
||||
'servers', 'os-extended-availability-zone')))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def _get_server(self, body):
|
||||
|
|
|
@ -109,7 +109,7 @@ class ExtendedIpsTestV21(test.TestCase):
|
|||
def _make_request(self, url):
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.headers['Accept'] = self.content_type
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('servers',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def _get_server(self, body):
|
||||
|
|
|
@ -114,7 +114,7 @@ class ExtendedIpsMacTestV21(test.TestCase):
|
|||
def _make_request(self, url):
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.headers['Accept'] = self.content_type
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('servers',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def _get_server(self, body):
|
||||
|
|
|
@ -92,8 +92,7 @@ class ExtendedServerAttributesTestV21(test.TestCase):
|
|||
req.headers = {os_wsgi.API_VERSION_REQUEST_HEADER:
|
||||
'compute %s' % self.wsgi_api_version}
|
||||
res = req.get_response(
|
||||
fakes.wsgi_app_v21(init_only=('servers',
|
||||
'os-extended-server-attributes')))
|
||||
fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def _get_server(self, body):
|
||||
|
|
|
@ -58,9 +58,7 @@ class ExtendedStatusTestV21(test.TestCase):
|
|||
def _make_request(self, url):
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.headers['Accept'] = self.content_type
|
||||
res = req.get_response(fakes.wsgi_app_v21(
|
||||
init_only=('servers',
|
||||
'os-extended-status')))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -105,8 +105,7 @@ class ExtendedVolumesTestV21(test.TestCase):
|
|||
self.stub_out('nova.db.instance_get_by_uuid', return_server)
|
||||
|
||||
def _setup_app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('os-extended-volumes',
|
||||
'servers'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def _setUp(self):
|
||||
self.Controller = extended_volumes_v21.ExtendedVolumesController()
|
||||
|
|
|
@ -38,7 +38,7 @@ class FlavorDisabledTestV21(test.NoDBTestCase):
|
|||
def _make_request(self, url):
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.headers['Accept'] = self.content_type
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('flavors',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def _get_flavor(self, body):
|
||||
|
|
|
@ -96,10 +96,7 @@ class FlavorManageTestV21(test.NoDBTestCase):
|
|||
|
||||
@property
|
||||
def app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('os-flavor-manage',
|
||||
'os-flavor-rxtx',
|
||||
'os-flavor-access', 'flavors',
|
||||
'os-flavor-extra-data'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
@mock.patch('nova.objects.Flavor.destroy')
|
||||
def test_delete(self, mock_destroy):
|
||||
|
@ -369,11 +366,7 @@ class PrivateFlavorManageTestV21(test.TestCase):
|
|||
|
||||
@property
|
||||
def app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('os-flavor-manage',
|
||||
'os-flavor-access',
|
||||
'os-flavor-rxtx', 'flavors',
|
||||
'os-flavor-extra-data'),
|
||||
fake_auth_context=self._get_http_request().
|
||||
return fakes.wsgi_app_v21(fake_auth_context=self._get_http_request().
|
||||
environ['nova.context'])
|
||||
|
||||
def _get_http_request(self, url=''):
|
||||
|
|
|
@ -35,8 +35,7 @@ class FlavorRxtxTestV21(test.NoDBTestCase):
|
|||
return res
|
||||
|
||||
def _get_app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('servers',
|
||||
'flavors', 'os-flavor-rxtx'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def _get_flavor(self, body):
|
||||
return jsonutils.loads(body).get('flavor')
|
||||
|
|
|
@ -32,7 +32,7 @@ class FlavorSwapTestV21(test.NoDBTestCase):
|
|||
def _make_request(self, url):
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.headers['Accept'] = self.content_type
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('flavors',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def _get_flavor(self, body):
|
||||
|
|
|
@ -29,7 +29,7 @@ class FlavorExtraDataTestV21(test.NoDBTestCase):
|
|||
|
||||
@property
|
||||
def app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('flavors'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def _verify_flavor_response(self, flavor, expected):
|
||||
for key in expected:
|
||||
|
|
|
@ -40,8 +40,7 @@ class HideServerAddressesTestV21(test.TestCase):
|
|||
base_url = '/v2/fake/servers'
|
||||
|
||||
def _setup_wsgi(self):
|
||||
self.wsgi_app = fakes.wsgi_app_v21(
|
||||
init_only=('servers', 'os-hide-server-addresses'))
|
||||
self.wsgi_app = fakes.wsgi_app_v21()
|
||||
|
||||
def setUp(self):
|
||||
super(HideServerAddressesTestV21, self).setUp()
|
||||
|
|
|
@ -93,7 +93,7 @@ class ImageSizeTestV21(test.NoDBTestCase):
|
|||
return res
|
||||
|
||||
def _get_app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('images', 'image-size'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def _get_image(self, body):
|
||||
return jsonutils.loads(body).get('image')
|
||||
|
|
|
@ -70,8 +70,7 @@ class KeypairsTestV21(test.TestCase):
|
|||
wsgi_api_version = os_wsgi.DEFAULT_API_VERSION
|
||||
|
||||
def _setup_app_and_controller(self):
|
||||
self.app_server = fakes.wsgi_app_v21(init_only=('os-keypairs',
|
||||
'servers'))
|
||||
self.app_server = fakes.wsgi_app_v21()
|
||||
self.controller = keypairs_v21.KeypairController()
|
||||
|
||||
def setUp(self):
|
||||
|
@ -567,7 +566,7 @@ class KeypairsTestV235(test.TestCase):
|
|||
wsgi_api_version = '2.35'
|
||||
|
||||
def _setup_app_and_controller(self):
|
||||
self.app_server = fakes.wsgi_app_v21(init_only=('os-keypairs'))
|
||||
self.app_server = fakes.wsgi_app_v21()
|
||||
self.controller = keypairs_v21.KeypairController()
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -46,7 +46,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
@mock.patch("nova.api.openstack.APIRouterV21.api_extension_namespace",
|
||||
return_value='nova.api.v21.test_extensions')
|
||||
def test_microversions_no_header(self, mock_namespace):
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions')
|
||||
res = req.get_response(app)
|
||||
self.assertEqual(200, res.status_int)
|
||||
|
@ -56,7 +56,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
@mock.patch("nova.api.openstack.APIRouterV21.api_extension_namespace",
|
||||
return_value='nova.api.v21.test_extensions')
|
||||
def test_microversions_return_header(self, mock_namespace):
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions')
|
||||
res = req.get_response(app)
|
||||
self.assertEqual(200, res.status_int)
|
||||
|
@ -75,7 +75,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("2.3")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions')
|
||||
req.headers = self._make_header('2.3')
|
||||
res = req.get_response(app)
|
||||
|
@ -95,7 +95,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.0")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions')
|
||||
req.headers = self._make_header('3.0')
|
||||
res = req.get_response(app)
|
||||
|
@ -113,7 +113,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_namespace, mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest('2.3')
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.headers = self._make_header(req_version)
|
||||
res = req.get_response(app)
|
||||
|
@ -139,7 +139,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
def test_microversions2_later_version(self, mock_namespace, mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.1")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
|
||||
req.headers = self._make_header('3.0')
|
||||
res = req.get_response(app)
|
||||
|
@ -154,7 +154,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.5")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
|
||||
req.headers = {self.header_name: '3.2'}
|
||||
res = req.get_response(app)
|
||||
|
@ -163,7 +163,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
@mock.patch("nova.api.openstack.APIRouterV21.api_extension_namespace",
|
||||
return_value='nova.api.v21.test_extensions')
|
||||
def test_microversions2_version_too_low(self, mock_namespace):
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
|
||||
req.headers = {self.header_name: '2.1'}
|
||||
res = req.get_response(app)
|
||||
|
@ -176,7 +176,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.5")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions2')
|
||||
req.headers = self._make_header('3.7')
|
||||
res = req.get_response(app)
|
||||
|
@ -192,7 +192,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
def test_microversions_schema(self, mock_namespace, mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions3')
|
||||
req.method = 'POST'
|
||||
req.headers = self._make_header('2.2')
|
||||
|
@ -215,7 +215,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
def test_microversions_schema_fail(self, mock_namespace, mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions3')
|
||||
req.method = 'POST'
|
||||
req.headers = {self.header_name: '2.2'}
|
||||
|
@ -235,7 +235,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions3/1')
|
||||
req.method = 'PUT'
|
||||
req.headers = self._make_header('2.2')
|
||||
|
@ -258,7 +258,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("3.3")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions3/1')
|
||||
req.headers = self._make_header('2.10')
|
||||
req.environ['CONTENT_TYPE'] = "application/json"
|
||||
|
@ -281,7 +281,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_namespace,
|
||||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("2.2")
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions4')
|
||||
req.headers = self._make_header(version)
|
||||
req.environ['CONTENT_TYPE'] = "application/json"
|
||||
|
@ -307,7 +307,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
def test_with_extends_decorator(self, mock_namespace, mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest('2.4')
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions5/item')
|
||||
req.headers = {'X-OpenStack-Nova-API-Version': '2.4'}
|
||||
res = req.get_response(app)
|
||||
|
@ -332,7 +332,7 @@ class LegacyMicroversionsTest(test.NoDBTestCase):
|
|||
mock_maxver):
|
||||
mock_maxver.return_value = api_version.APIVersionRequest("2.3")
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-microversions')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/microversions3/1/action')
|
||||
if req_header:
|
||||
req.headers = self._make_header(req_header)
|
||||
|
|
|
@ -510,8 +510,7 @@ class TestNeutronSecurityGroupsOutputTest(TestNeutronSecurityGroupsTestCase):
|
|||
|
||||
# NOTE: This 'os-security-groups' is for enabling security_groups
|
||||
# attribute on response body.
|
||||
res = req.get_response(fakes.wsgi_app_v21(
|
||||
init_only=('servers', 'os-security-groups')))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
return res
|
||||
|
||||
def _encode_body(self, body):
|
||||
|
|
|
@ -25,7 +25,7 @@ class PluginTest(test.NoDBTestCase):
|
|||
def test_plugin_framework_index(self, mock_namespace):
|
||||
mock_namespace.return_value = 'nova.api.v21.test_extensions'
|
||||
|
||||
app = fakes.wsgi_app_v21(init_only='test-basic')
|
||||
app = fakes.wsgi_app_v21()
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/test')
|
||||
res = req.get_response(app)
|
||||
self.assertEqual(200, res.status_int)
|
||||
|
|
|
@ -43,8 +43,7 @@ class SchedulerHintsTestCaseV21(test.TestCase):
|
|||
self._set_up_router()
|
||||
|
||||
def _set_up_router(self):
|
||||
self.app = compute.APIRouterV21(init_only=('servers',
|
||||
'os-scheduler-hints'))
|
||||
self.app = compute.APIRouterV21()
|
||||
|
||||
def _get_request(self):
|
||||
return fakes.HTTPRequest.blank('/fake/servers')
|
||||
|
|
|
@ -1316,7 +1316,7 @@ class SecurityGroupsOutputTestV21(test.TestCase):
|
|||
self.app = self._setup_app()
|
||||
|
||||
def _setup_app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('os-security-groups', 'servers'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def _make_request(self, url, body=None):
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
|
|
|
@ -40,8 +40,7 @@ def fake_instance_get(self, _context, instance_uuid, expected_attrs=None):
|
|||
class ServerDiagnosticsTestV21(test.NoDBTestCase):
|
||||
|
||||
def _setup_router(self):
|
||||
self.router = compute.APIRouterV21(init_only=('servers',
|
||||
'os-server-diagnostics'))
|
||||
self.router = compute.APIRouterV21()
|
||||
|
||||
def _get_request(self):
|
||||
return fakes.HTTPRequest.blank(
|
||||
|
|
|
@ -74,7 +74,7 @@ class ServerUsageTestV21(test.TestCase):
|
|||
return res
|
||||
|
||||
def _get_app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('servers', 'os-server-usage'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def _get_server(self, body):
|
||||
return jsonutils.loads(body).get('server')
|
||||
|
|
|
@ -33,8 +33,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
# Test URL path specifying v2 returns v2 content.
|
||||
req = fakes.HTTPRequest.blank('/v2/')
|
||||
req.accept = "application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('versions',),
|
||||
v2_compatible=True))
|
||||
res = req.get_response(fakes.wsgi_app_v21(v2_compatible=True))
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -45,8 +44,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
req = fakes.HTTPRequest.blank('/')
|
||||
req.content_type = "application/json;version=2"
|
||||
req.accept = "application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('versions',),
|
||||
v2_compatible=True))
|
||||
res = req.get_response(fakes.wsgi_app_v21(v2_compatible=True))
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -56,8 +54,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
# Test Accept header specifying v2 returns v2 content.
|
||||
req = fakes.HTTPRequest.blank('/')
|
||||
req.accept = "application/json;version=2"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('versions',),
|
||||
v2_compatible=True))
|
||||
res = req.get_response(fakes.wsgi_app_v21(v2_compatible=True))
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -68,7 +65,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
url = '/v2/fake/images/cedef40a-ed67-4d10-800e-17455edce175.json'
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.accept = "application/xml"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('images',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -80,7 +77,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
url = '/v2/fake/images/cedef40a-ed67-4d10-800e-17455edce175'
|
||||
req = fakes.HTTPRequest.blank(url)
|
||||
req.accept = "application/xml;q=0.8, application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('images',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -91,7 +88,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
# Test URL path specifying v2.1 returns v2.1 content.
|
||||
req = fakes.HTTPRequest.blank('/v2.1/')
|
||||
req.accept = "application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('versions',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -102,7 +99,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
req = fakes.HTTPRequest.blank('/')
|
||||
req.content_type = "application/json;version=2.1"
|
||||
req.accept = "application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('versions',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -112,7 +109,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
# Test Accept header specifying v2.1 returns v2.1 content.
|
||||
req = fakes.HTTPRequest.blank('/')
|
||||
req.accept = "application/json;version=2.1"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('versions',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
@ -123,7 +120,7 @@ class UrlmapTest(test.NoDBTestCase):
|
|||
req = fakes.HTTPRequest.blank('/')
|
||||
req.content_type = "application/json;version=2.1"
|
||||
req.accept = "application/xml;q=0.8, application/json"
|
||||
res = req.get_response(fakes.wsgi_app_v21(init_only=('versions',)))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(200, res.status_int)
|
||||
self.assertEqual("application/json", res.content_type)
|
||||
body = jsonutils.loads(res.body)
|
||||
|
|
|
@ -104,7 +104,7 @@ class VersionsTestV21WithV2CompatibleWrapper(test.NoDBTestCase):
|
|||
|
||||
@property
|
||||
def wsgi_app(self):
|
||||
return fakes.wsgi_app_v21(v2_compatible=True, init_only=('versions',))
|
||||
return fakes.wsgi_app_v21(v2_compatible=True)
|
||||
|
||||
def test_get_version_list(self):
|
||||
req = fakes.HTTPRequest.blank('/', base_url='')
|
||||
|
@ -446,7 +446,7 @@ class VersionsTestV21(test.NoDBTestCase):
|
|||
|
||||
@property
|
||||
def wsgi_app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('versions',))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def test_get_version_list_302(self):
|
||||
req = fakes.HTTPRequest.blank('/v2.1')
|
||||
|
@ -511,7 +511,7 @@ class VersionBehindSslTestCase(test.NoDBTestCase):
|
|||
|
||||
@property
|
||||
def wsgi_app(self):
|
||||
return fakes.wsgi_app_v21(v2_compatible=True, init_only=('versions',))
|
||||
return fakes.wsgi_app_v21(v2_compatible=True)
|
||||
|
||||
def test_versions_without_headers(self):
|
||||
req = wsgi.Request.blank('/')
|
||||
|
|
|
@ -174,8 +174,7 @@ class BootFromVolumeTest(test.TestCase):
|
|||
req.method = 'POST'
|
||||
req.body = jsonutils.dump_as_bytes(body)
|
||||
req.headers['content-type'] = 'application/json'
|
||||
res = req.get_response(fakes.wsgi_app_v21(
|
||||
init_only=('os-volumes', 'servers')))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(202, res.status_int)
|
||||
server = jsonutils.loads(res.body)['server']
|
||||
self.assertEqual(FAKE_UUID, server['id'])
|
||||
|
@ -203,8 +202,7 @@ class BootFromVolumeTest(test.TestCase):
|
|||
req.method = 'POST'
|
||||
req.body = jsonutils.dump_as_bytes(body)
|
||||
req.headers['content-type'] = 'application/json'
|
||||
res = req.get_response(fakes.wsgi_app_v21(
|
||||
init_only=('os-volumes', 'servers')))
|
||||
res = req.get_response(fakes.wsgi_app_v21())
|
||||
self.assertEqual(202, res.status_int)
|
||||
server = jsonutils.loads(res.body)['server']
|
||||
self.assertEqual(FAKE_UUID, server['id'])
|
||||
|
@ -232,7 +230,7 @@ class VolumeApiTestV21(test.NoDBTestCase):
|
|||
|
||||
@property
|
||||
def app(self):
|
||||
return fakes.wsgi_app_v21(init_only=('os-volumes', 'servers'))
|
||||
return fakes.wsgi_app_v21()
|
||||
|
||||
def test_volume_create(self):
|
||||
self.stubs.Set(cinder.API, "create", fakes.stub_volume_create)
|
||||
|
|
|
@ -62,7 +62,7 @@ def fake_wsgi(self, req):
|
|||
return self.application
|
||||
|
||||
|
||||
def wsgi_app_v21(fake_auth_context=None, init_only=None, v2_compatible=False):
|
||||
def wsgi_app_v21(fake_auth_context=None, v2_compatible=False):
|
||||
|
||||
inner_app_v21 = compute.APIRouterV21()
|
||||
|
||||
|
|
Loading…
Reference in New Issue