Fix test suite bug with barbican client

Barbican python client has implemented new methods in 5.5.0
which requires call to barbican API to create client.
There are no way for now to really get a fake barbican client.
Mocking the method responsible of that call in the tests
so it doesn't need to make the API call.

Change-Id: I6a607c8941bdb219de1cc212403124dea8ccac23
This commit is contained in:
Axel Vanzaghi 2023-03-17 14:46:30 +00:00
parent e0687d6073
commit 44b3e5dff5
1 changed files with 8 additions and 0 deletions

View File

@ -24,6 +24,9 @@ from mistral_extra import config
from mistral_extra.tests.unit import base
import barbicanclient.v1.client as barbicanclient_test
from unittest import mock
ABSOLUTE_TEST_MAPPING_PATH = os.path.realpath(
os.path.join(os.path.dirname(__file__),
"../../../resources/openstack/test_mapping.json")
@ -87,6 +90,11 @@ class GeneratorTest(base.BaseTest):
actions.ZunAction, "get_fake_client_method",
return_value=lambda x: None))
@mock.patch.object(
barbicanclient_test.Client,
'_get_max_supported_version',
mock.Mock(return_value="1.1")
)
def test_generator(self):
for generator_cls in generator_factory.all_generators():
action_classes = generator_cls.create_actions()