Cloner: clone() recursion support, TODO: recursion tests
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
@@ -17,6 +17,7 @@ class MockConfig:
|
||||
self.cloner_repo_url = ""
|
||||
self.cloner_project_name = "Mocked Project"
|
||||
self.cloner_interval = 0
|
||||
self.cloner_submodules = False
|
||||
|
||||
|
||||
class MockDirStruct:
|
||||
@@ -239,7 +240,7 @@ def test_clone_from_url(tmp_path, path_repo_base):
|
||||
mock = MockDirStruct(tmp_path)
|
||||
mock.config.cloner_repo_url = "invalid"
|
||||
c = Cloner(mock)
|
||||
assert c.clone_from_url(path_repo_base.as_uri())
|
||||
assert c.clone(path_repo_base.as_uri())
|
||||
assert "e0c7e2a72579e24657c05e875201011d2b48bf94" == c._repo._repo.head.commit.hexsha
|
||||
|
||||
|
||||
@@ -250,6 +251,6 @@ def test_clone_from_url_initialized(tmp_path, path_repo_base, caplog):
|
||||
mock.config.cloner_repo_url = path_repo_base.as_uri()
|
||||
git.Repo().init(path)
|
||||
c = Cloner(mock)
|
||||
assert not c.clone_from_url(path_repo_base.as_uri())
|
||||
assert not c.clone(path_repo_base.as_uri())
|
||||
assert caplog.records[0].levelname == "CRITICAL"
|
||||
assert caplog.records[0].message == f"Repo path {path} is initialized... Refusing clone!"
|
||||
|
||||
Reference in New Issue
Block a user