From cd837a7a1da98c64d309afe688909304891c9cbc Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Tue, 19 Jul 2022 16:54:47 +0200 Subject: [PATCH] Update tests to work with new alias version structure --- tests/test_dependency_mgmt.py | 6 ++++-- tests/test_dependency_mgmt_version_parsing.py | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test_dependency_mgmt.py b/tests/test_dependency_mgmt.py index 5d71f9907..5639e7bae 100644 --- a/tests/test_dependency_mgmt.py +++ b/tests/test_dependency_mgmt.py @@ -261,6 +261,7 @@ def test_register_components_and_aliases( cn: DependencySpec(f"https://fake.repo.url/{cn}.git", "master", "") for cn in component_dirs } + patch_read.return_value["fooer"] = patch_read.return_value["foo"] dependency_mgmt.register_components(config) @@ -320,6 +321,7 @@ def test_register_dangling_aliases( cn: DependencySpec(f"https://fake.repo.url/{cn}.git", "master", "") for cn in component_dirs } + patch_read.return_value["bazzer"] = patch_read.return_value["baz"] dependency_mgmt.register_components(config) @@ -473,10 +475,10 @@ def test_validate_component_library_name(tmp_path: Path, libname: str, expected: ) def test_verify_component_version_overrides(cluster_params: dict, expected: str): if expected == "": - dependency_mgmt.verify_version_overrides(cluster_params) + dependency_mgmt.verify_version_overrides(cluster_params, {}) else: with pytest.raises(click.ClickException) as e: - dependency_mgmt.verify_version_overrides(cluster_params) + dependency_mgmt.verify_version_overrides(cluster_params, {}) assert expected in str(e) diff --git a/tests/test_dependency_mgmt_version_parsing.py b/tests/test_dependency_mgmt_version_parsing.py index b31df7927..f10d7d3dc 100644 --- a/tests/test_dependency_mgmt_version_parsing.py +++ b/tests/test_dependency_mgmt_version_parsing.py @@ -23,7 +23,9 @@ @patch.object(version_parsing, "kapitan_inventory") def test_read_components(patch_inventory, config: Config): components = _setup_mock_inventory(patch_inventory) - cspecs = version_parsing._read_components(config, ["test-component"]) + cspecs = version_parsing._read_components( + config, {"test-component": "test-component"} + ) # check that exactly 'test-component' is discovered assert {"test-component"} == set(cspecs.keys()) @@ -34,7 +36,7 @@ def test_read_components(patch_inventory, config: Config): @patch.object(version_parsing, "kapitan_inventory") def test_read_components_multiple(patch_inventory, config: Config): components = _setup_mock_inventory(patch_inventory) - cspecs = version_parsing._read_components(config, components.keys()) + cspecs = version_parsing._read_components(config, {k: k for k in components.keys()}) # check that exactly 'test-component' is discovered assert set(components.keys()) == set(cspecs.keys()) assert all(components[cn]["url"] == cspecs[cn].url for cn in components.keys()) @@ -80,7 +82,7 @@ def test_read_components_exc( } with pytest.raises(click.ClickException) as exc_info: - _ = version_parsing._read_components(config, ckeys) + _ = version_parsing._read_components(config, {k: k for k in ckeys}) assert exc_info.value.args[0] == exctext