diff options
author | Zuul <zuul@review.opendev.org> | 2022-08-03 17:44:37 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-08-03 17:44:37 +0000 |
commit | 3b4378c1890337a096b26f1a5335620d475cb778 (patch) | |
tree | ba2d557e4d2ecf97c4ad89a76501877e04c2d835 /nova | |
parent | 8fe928156ae7db920cfc5db6a0ef955ff3bd241c (diff) | |
parent | 6069592bcf9853f12390140d1792a812fa616b12 (diff) | |
download | nova-3b4378c1890337a096b26f1a5335620d475cb778.tar.gz |
Merge "Fix mocking SafeConnectedTestCase"
Diffstat (limited to 'nova')
-rw-r--r-- | nova/tests/unit/scheduler/client/test_report.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py index 288a7530aa..9a1766927c 100644 --- a/nova/tests/unit/scheduler/client/test_report.py +++ b/nova/tests/unit/scheduler/client/test_report.py @@ -42,8 +42,14 @@ class SafeConnectedTestCase(test.NoDBTestCase): super(SafeConnectedTestCase, self).setUp() self.context = context.get_admin_context() - with mock.patch('keystoneauth1.loading.load_auth_from_conf_options'): - self.client = report.SchedulerReportClient() + # need to mock this globally as SchedulerReportClient._create_client + # is called again when EndpointNotFound is raised + self.useFixture( + fixtures.MonkeyPatch( + 'keystoneauth1.loading.load_auth_from_conf_options', + mock.MagicMock())) + + self.client = report.SchedulerReportClient() @mock.patch('keystoneauth1.session.Session.request') def test_missing_endpoint(self, req): |