Merge "functional: Move single-use function to its caller"
This commit is contained in:
commit
3d43c542a6
|
@ -1045,21 +1045,6 @@ class _IntegratedTestBase(test.TestCase, PlacementInstanceHelperMixin):
|
|||
if not self.ADMIN_API:
|
||||
self.admin_api.microversion = self.microversion
|
||||
|
||||
def _check_api_endpoint(self, endpoint, expected_middleware):
|
||||
app = self.api_fixture.app().get((None, '/v2'))
|
||||
|
||||
while getattr(app, 'application', False):
|
||||
for middleware in expected_middleware:
|
||||
if isinstance(app.application, middleware):
|
||||
expected_middleware.remove(middleware)
|
||||
break
|
||||
app = app.application
|
||||
|
||||
self.assertEqual([],
|
||||
expected_middleware,
|
||||
("The expected wsgi middlewares %s are not "
|
||||
"existed") % expected_middleware)
|
||||
|
||||
|
||||
# TODO(stephenfin): This is almost identical to '_IntegratedTestBase' now and
|
||||
# could be removed
|
||||
|
|
|
@ -24,7 +24,21 @@ class LegacyV2CompatibleTestBase(integrated_helpers._IntegratedTestBase):
|
|||
|
||||
def setUp(self):
|
||||
super(LegacyV2CompatibleTestBase, self).setUp()
|
||||
self._check_api_endpoint('/v2', [openstack.LegacyV2CompatibleWrapper])
|
||||
self._check_api_endpoint()
|
||||
|
||||
def _check_api_endpoint(self):
|
||||
app = self.api_fixture.app().get((None, '/v2'))
|
||||
|
||||
while getattr(app, 'application', False):
|
||||
if isinstance(
|
||||
app.application, openstack.LegacyV2CompatibleWrapper,
|
||||
):
|
||||
break
|
||||
app = app.application
|
||||
else:
|
||||
raise Exception(
|
||||
'The LegacyV2CompatibleWrapper middleware is not configured.'
|
||||
)
|
||||
|
||||
def test_request_with_microversion_headers(self):
|
||||
self.api.microversion = '2.100'
|
||||
|
|
Loading…
Reference in New Issue