summaryrefslogtreecommitdiff
path: root/nova
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-08-03 17:44:37 +0000
committerGerrit Code Review <review@openstack.org>2022-08-03 17:44:37 +0000
commit3b4378c1890337a096b26f1a5335620d475cb778 (patch)
treeba2d557e4d2ecf97c4ad89a76501877e04c2d835 /nova
parent8fe928156ae7db920cfc5db6a0ef955ff3bd241c (diff)
parent6069592bcf9853f12390140d1792a812fa616b12 (diff)
downloadnova-3b4378c1890337a096b26f1a5335620d475cb778.tar.gz
Merge "Fix mocking SafeConnectedTestCase"
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/unit/scheduler/client/test_report.py10
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):