feat: small refactorings
Test and coverage / build (push) Failing after 56s

This commit is contained in:
2026-06-28 01:18:08 +03:00
parent 17aaa41101
commit 998665a4bf
13 changed files with 634 additions and 140 deletions
+26 -1
View File
@@ -1,6 +1,7 @@
import pytest
from src.repository_name import is_valid_format
from src.repository_name import get_repository_path, is_valid_format
from tests.test_mirror_process import make_repo
@pytest.mark.parametrize(
@@ -13,3 +14,27 @@ from src.repository_name import is_valid_format
)
def test_name_formatting(name_format, expected):
assert is_valid_format(name_format) == expected
@pytest.mark.parametrize(
"name_format",
[
"../{name}",
"/tmp/{name}",
],
)
def test_repository_path_rejects_paths_outside_out_dir(tmp_path, name_format):
with pytest.raises(ValueError):
get_repository_path(
out_dir=str(tmp_path),
name_format=name_format,
repo=make_repo(),
)
def test_repository_path_returns_path_inside_out_dir(tmp_path):
assert get_repository_path(
out_dir=str(tmp_path),
name_format="{owner}/{name}",
repo=make_repo(),
) == str(tmp_path / "alex" / "repo")