From 15c465f454f31457ff22b7d0027a8e7eb8e419dc Mon Sep 17 00:00:00 2001 From: mhecko Date: Sun, 9 Apr 2023 21:03:30 +0200 Subject: [PATCH] checkrhui(tests): fix tests not mocking api.get_common_folder_path --- .../common/actors/cloud/checkrhui/libraries/checkrhui.py | 2 ++ .../actors/cloud/checkrhui/tests/component_test_checkrhui.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/repos/system_upgrade/common/actors/cloud/checkrhui/libraries/checkrhui.py b/repos/system_upgrade/common/actors/cloud/checkrhui/libraries/checkrhui.py index bd269db457..23241d0988 100644 --- a/repos/system_upgrade/common/actors/cloud/checkrhui/libraries/checkrhui.py +++ b/repos/system_upgrade/common/actors/cloud/checkrhui/libraries/checkrhui.py @@ -16,6 +16,8 @@ def create_amazon_id_dnf_plugin_copy_task(): def produce_rhui_info_for_provider(provider): + if not provider: + return upgrade_path = rhui.get_upg_path() cloud_map_entry = rhui.RHUI_CLOUD_MAP[upgrade_path][provider] diff --git a/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py b/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py index fde5ea7298..4e1ca1bf80 100644 --- a/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py +++ b/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py @@ -4,6 +4,7 @@ from leapp.libraries.common import rhsm from leapp.libraries.common.config import mock_configs +from leapp.libraries.stdlib import api from leapp.models import ( InstalledRedHatSignedRPM, InstalledRPM, @@ -51,6 +52,7 @@ def test_check_rhui_actor( monkeypatch, current_actor_context, skip_rhsm, msgs_received, installed_rpms ): monkeypatch.setattr(rhsm, 'skip_rhsm', lambda: skip_rhsm) + monkeypatch.setattr(api, 'get_common_folder_path', lambda dummy: '/commons') current_actor_context.feed(create_modulesfacts(installed_rpm=installed_rpms)) current_actor_context.run(config_model=mock_configs.CONFIG)