From 8eb4da8724d3dc8cabe942cd19b64804c0d23d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek?= Date: Wed, 27 Jul 2022 14:04:39 +0200 Subject: [PATCH] test repo checksum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Valíček --- tests/lib/test_repo_tool.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/lib/test_repo_tool.py b/tests/lib/test_repo_tool.py index ab42c5c..197a6dc 100644 --- a/tests/lib/test_repo_tool.py +++ b/tests/lib/test_repo_tool.py @@ -280,8 +280,6 @@ def test_fetch_diferent_tags(cloned_base_repo_obj: RepoTool, path_repo_different assert cloned_base_repo_obj.fetch() - print(branches) - branches = prepare_collection_list(cloned_base_repo_obj._repo.branches) assert branches == [ ('br0', '1fe320fe278a40bfd6813860d9952b03caf5e2ea'), @@ -401,3 +399,23 @@ def test_fetch_reduced(cloned_base_repo_obj: RepoTool, path_repo_reduced: Path): ('wip-003', 'd3e906333be8a6ff09f96e827199d51694a16dc1'), ('wip-r/1', '030cc2b97d8ecbf07b7bd361105f07e631393f00') ] + + +@pytest.mark.parametrize("repo,hash", [ + ("test-repo-base", "d5803947514ee6d7834157421171a94174a516dc9606de6aa52e28e71cea2c0e"), + ("test-repo-different-tags", "30a8507cb85c5fe7d07c1ef9a95eeed55fedd5c874f4fe723c2f9f56b0a96856"), + ("test-repo-changed-branches", "a987fd182cb173f6913eaeb774aa710c26112dc9f5ea8cd10c75efa614768444"), + ("test-repo-new-commits", "1a67df432e2206089ec019e272d91051b7ead0334dd03955352656e29e603813"), + ("test-repo-reduced", "fb7fd812ec30265ecc3014824e467746112403dab114cf37907facb10a85a3e2"), + ("nonexistent-repo.git", False), + +]) +def test_fingerprint(support_data_path: Path, repo: str, hash): + path = support_data_path.joinpath(repo).as_posix() + rt = RepoTool(path) + if hash: + assert rt.initialized + else: + assert not rt.initialized + + assert rt.repo_fingerprint() == hash