Skip to content

Commit 3d43c54

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "functional: Move single-use function to its caller"
2 parents d793835 + 1cb9a3a commit 3d43c54

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

nova/tests/functional/integrated_helpers.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,21 +1045,6 @@ def _setup_services(self):
10451045
if not self.ADMIN_API:
10461046
self.admin_api.microversion = self.microversion
10471047

1048-
def _check_api_endpoint(self, endpoint, expected_middleware):
1049-
app = self.api_fixture.app().get((None, '/v2'))
1050-
1051-
while getattr(app, 'application', False):
1052-
for middleware in expected_middleware:
1053-
if isinstance(app.application, middleware):
1054-
expected_middleware.remove(middleware)
1055-
break
1056-
app = app.application
1057-
1058-
self.assertEqual([],
1059-
expected_middleware,
1060-
("The expected wsgi middlewares %s are not "
1061-
"existed") % expected_middleware)
1062-
10631048

10641049
# TODO(stephenfin): This is almost identical to '_IntegratedTestBase' now and
10651050
# could be removed

nova/tests/functional/test_legacy_v2_compatible_wrapper.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,21 @@ class LegacyV2CompatibleTestBase(integrated_helpers._IntegratedTestBase):
2424

2525
def setUp(self):
2626
super(LegacyV2CompatibleTestBase, self).setUp()
27-
self._check_api_endpoint('/v2', [openstack.LegacyV2CompatibleWrapper])
27+
self._check_api_endpoint()
28+
29+
def _check_api_endpoint(self):
30+
app = self.api_fixture.app().get((None, '/v2'))
31+
32+
while getattr(app, 'application', False):
33+
if isinstance(
34+
app.application, openstack.LegacyV2CompatibleWrapper,
35+
):
36+
break
37+
app = app.application
38+
else:
39+
raise Exception(
40+
'The LegacyV2CompatibleWrapper middleware is not configured.'
41+
)
2842

2943
def test_request_with_microversion_headers(self):
3044
self.api.microversion = '2.100'

0 commit comments

Comments
 (0)