diff --git a/tests/lib/test_cloner.py b/tests/lib/test_cloner.py index f34ab8f..ffd677e 100644 --- a/tests/lib/test_cloner.py +++ b/tests/lib/test_cloner.py @@ -1,5 +1,6 @@ import git import pytest +from repo_cloner.lib.checksum import gen_repo_hashed_name import repo_cloner.lib.dir_not_found_error from cloner_test_fixtures import * from repo_cloner.lib.cloner import Cloner @@ -127,9 +128,10 @@ def test_repo_path_by_url(cloner_dir_struct: Path, path_repo_base: Path): def test__main_repo_path(cloner_dir_struct: Path, path_repo_base: Path): ds = MockDirStruct(cloner_dir_struct) ds.config.cloner_repo_url = path_repo_base.as_uri() + hashed = gen_repo_hashed_name(path_repo_base.as_uri()) c = Cloner(ds) x = c._Cloner__main_repo_path - assert x == ds.repos_dir.joinpath("_support_data_test-repo-base_402961715.git").as_posix() + assert x == ds.repos_dir.joinpath(hashed).as_posix() def test_sync(cloner_dir_struct, tmp_path, monkeypatch): @@ -222,7 +224,8 @@ def test_open_uninitialized(cloner_dir_with_config, path_repo_base): def test_open_initialized(cloner_dir_with_config, path_repo_base, caplog): mock = MockDirStruct(cloner_dir_with_config) - path = cloner_dir_with_config.joinpath("repos", "_support_data_test-repo-base_402961715.git").as_posix() + hashed = gen_repo_hashed_name(path_repo_base.as_uri()) + path = cloner_dir_with_config.joinpath("repos", hashed).as_posix() mock.config.cloner_repo_url = path_repo_base.as_uri() r = git.Repo().clone_from(path_repo_base.as_uri(), path, bare = True) commit = r.head.commit.hexsha @@ -242,9 +245,10 @@ def test_clone_from_url(tmp_path, path_repo_base): def test_clone_from_url_initialized(tmp_path, path_repo_base, caplog): mock = MockDirStruct(tmp_path) - path = tmp_path.joinpath("repos", "_support_data_test-repo-base_402961715.git").as_posix() + hashed = gen_repo_hashed_name(path_repo_base.as_uri()) + path = tmp_path.joinpath("repos", hashed).as_posix() mock.config.cloner_repo_url = path_repo_base.as_uri() - r = git.Repo().init(path) + git.Repo().init(path) c = Cloner(mock) assert not c.clone_from_url(path_repo_base.as_uri()) assert caplog.records[0].levelname == "CRITICAL"