From 178611ef5d15938e5bf57e5d516374a12cad75eb Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 25 May 2026 11:00:48 -0400 Subject: [PATCH] Fix unit test failures in CI (#1133) (#1134) (cherry picked from commit f69761f37cf6367d9693d0ac93c62b2c10e11cff) Co-authored-by: Bianca Henderson --- tests/unit/module_utils/test_client.py | 35 +++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/tests/unit/module_utils/test_client.py b/tests/unit/module_utils/test_client.py index d3fec229..02363aaf 100644 --- a/tests/unit/module_utils/test_client.py +++ b/tests/unit/module_utils/test_client.py @@ -57,6 +57,11 @@ def _create_temp_file(content=""): return name +def _assert_configuration(actual, expected): + for key, value in expected.items(): + assert getattr(actual, key) == value + + def test_create_auth_spec_ssl_no_options(): module = MagicMock() module.params = {} @@ -138,13 +143,14 @@ def test_load_kube_config_from_file_path(): auth = {"kubeconfig": config_file, "context": "simple_token"} actual_configuration = _create_configuration(auth) - expected_configuration = { - "host": TEST_HOST, - "kubeconfig": config_file, - "context": "simple_token", - } - - assert expected_configuration.items() <= actual_configuration.__dict__.items() + _assert_configuration( + actual_configuration, + { + "host": TEST_HOST, + "kubeconfig": config_file, + "context": "simple_token", + }, + ) _remove_temp_file() @@ -152,13 +158,14 @@ def test_load_kube_config_from_dict(): auth_spec = {"kubeconfig": TEST_KUBE_CONFIG, "context": "simple_token"} actual_configuration = _create_configuration(auth_spec) - expected_configuration = { - "host": TEST_HOST, - "kubeconfig": TEST_KUBE_CONFIG, - "context": "simple_token", - } - - assert expected_configuration.items() <= actual_configuration.__dict__.items() + _assert_configuration( + actual_configuration, + { + "host": TEST_HOST, + "kubeconfig": TEST_KUBE_CONFIG, + "context": "simple_token", + }, + ) _remove_temp_file()