Skip to content

Commit

Permalink
Update tests to work with new alias version structure
Browse files Browse the repository at this point in the history
  • Loading branch information
simu committed Jul 19, 2022
1 parent a322f37 commit cd837a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tests/test_dependency_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
8 changes: 5 additions & 3 deletions tests/test_dependency_mgmt_version_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit cd837a7

Please sign in to comment.