Merge "Fix barbican credentials retrieval" into stable/yoga

This commit is contained in:
Zuul
2023-05-10 17:23:18 +00:00
committed by Gerrit Code Review
2 changed files with 7 additions and 5 deletions

View File

@@ -38,7 +38,7 @@ class NonOpenStackCredentialsDiscovery(EndpointDiscovery):
if not param:
return [barbican_secret]
barbican_endpoints = super(NonOpenStackCredentialsDiscovery,
self).discover("key-manager")
self).discover(manager, "key-manager")
if not barbican_endpoints:
LOG.warning("No Barbican endpoints found to execute the"
" credentials discovery process to [%s].",

View File

@@ -95,8 +95,8 @@ class TestNonOpenStackCredentialsDiscovery(base.BaseTestCase):
@mock.patch('keystoneclient.v2_0.client.Client')
def test_discover_response_ok(self, client_mock):
def discover_mock(self, manager, param=None):
return ["barbican_url"]
discover_mock = mock.MagicMock()
discover_mock.return_value = ["barbican_url"]
original_discover_method = EndpointDiscovery.discover
EndpointDiscovery.discover = discover_mock
@@ -108,9 +108,11 @@ class TestNonOpenStackCredentialsDiscovery(base.BaseTestCase):
client_mock.session.get.return_value = return_value
response = self.discovery.discover(
manager=self.FakeManager(client_mock), param="param")
fake_manager = self.FakeManager(client_mock)
response = self.discovery.discover(manager=fake_manager, param="param")
self.assertEqual(["content"], response)
discover_mock.assert_has_calls([
mock.call(fake_manager, "key-manager")])
EndpointDiscovery.discover = original_discover_method