test: domain expectations match corrected defaults
This commit is contained in:
@@ -86,7 +86,7 @@ class TestPushToBadgesBranch:
|
|||||||
|
|
||||||
class TestUpdateBadgeUrls:
|
class TestUpdateBadgeUrls:
|
||||||
def test_replaces_branch_url(self) -> None:
|
def test_replaces_branch_url(self) -> None:
|
||||||
content = "[]"
|
content = "[]"
|
||||||
result = push_badges.update_badge_urls(content, "abc123def456")
|
result = push_badges.update_badge_urls(content, "abc123def456")
|
||||||
assert "raw/commit/abc123def456/tests.svg" in result
|
assert "raw/commit/abc123def456/tests.svg" in result
|
||||||
assert "raw/branch/badges" not in result
|
assert "raw/branch/badges" not in result
|
||||||
@@ -95,7 +95,7 @@ class TestUpdateBadgeUrls:
|
|||||||
"""Old commit SHA URLs should be replaced with the new one."""
|
"""Old commit SHA URLs should be replaced with the new one."""
|
||||||
old_sha = "aabb123456789012345678901234567890123456" # 40 hex chars
|
old_sha = "aabb123456789012345678901234567890123456" # 40 hex chars
|
||||||
new_sha = "ccdd123456789012345678901234567890123456" # 40 hex chars
|
new_sha = "ccdd123456789012345678901234567890123456" # 40 hex chars
|
||||||
content = f"[]"
|
content = f"[]"
|
||||||
result = push_badges.update_badge_urls(content, new_sha)
|
result = push_badges.update_badge_urls(content, new_sha)
|
||||||
assert f"raw/commit/{new_sha}/tests.svg" in result
|
assert f"raw/commit/{new_sha}/tests.svg" in result
|
||||||
assert old_sha not in result
|
assert old_sha not in result
|
||||||
@@ -107,16 +107,16 @@ class TestUpdateBadgeUrls:
|
|||||||
|
|
||||||
def test_multiple_badges(self) -> None:
|
def test_multiple_badges(self) -> None:
|
||||||
content = (
|
content = (
|
||||||
"[]\n"
|
"[]\n"
|
||||||
"[]\n"
|
"[]\n"
|
||||||
"[]"
|
"[]"
|
||||||
)
|
)
|
||||||
result = push_badges.update_badge_urls(content, "abc123def456")
|
result = push_badges.update_badge_urls(content, "abc123def456")
|
||||||
assert result.count("raw/commit/abc123def456/") == 3
|
assert result.count("raw/commit/abc123def456/") == 3
|
||||||
assert "raw/branch/badges" not in result
|
assert "raw/branch/badges" not in result
|
||||||
|
|
||||||
def test_preserves_non_badge_urls(self) -> None:
|
def test_preserves_non_badge_urls(self) -> None:
|
||||||
content = "[]"
|
content = "[]"
|
||||||
result = push_badges.update_badge_urls(content, "abc123")
|
result = push_badges.update_badge_urls(content, "abc123")
|
||||||
assert result == content
|
assert result == content
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ class TestUpdateBadgeUrls:
|
|||||||
class TestUpdateReadmeWithBadgeSha:
|
class TestUpdateReadmeWithBadgeSha:
|
||||||
def test_updates_readme(self, tmp_path: Path) -> None:
|
def test_updates_readme(self, tmp_path: Path) -> None:
|
||||||
readme = tmp_path / "README.md"
|
readme = tmp_path / "README.md"
|
||||||
readme.write_text("[]")
|
readme.write_text("[]")
|
||||||
with patch("subprocess.run"):
|
with patch("subprocess.run"):
|
||||||
push_badges.update_readme_with_badge_sha("abc123def456", repo_root=tmp_path)
|
push_badges.update_readme_with_badge_sha("abc123def456", repo_root=tmp_path)
|
||||||
content = readme.read_text()
|
content = readme.read_text()
|
||||||
@@ -147,7 +147,7 @@ class TestUpdateReadmeWithBadgeSha:
|
|||||||
|
|
||||||
def test_version_verification_stale(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_version_verification_stale(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
readme = tmp_path / "README.md"
|
readme = tmp_path / "README.md"
|
||||||
readme.write_text("[]")
|
readme.write_text("[]")
|
||||||
monkeypatch.chdir(tmp_path)
|
monkeypatch.chdir(tmp_path)
|
||||||
badges_dir = tmp_path / ".badges"
|
badges_dir = tmp_path / ".badges"
|
||||||
badges_dir.mkdir(exist_ok=True)
|
badges_dir.mkdir(exist_ok=True)
|
||||||
@@ -159,7 +159,7 @@ class TestUpdateReadmeWithBadgeSha:
|
|||||||
|
|
||||||
def test_version_verification_current(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_version_verification_current(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
readme = tmp_path / "README.md"
|
readme = tmp_path / "README.md"
|
||||||
readme.write_text("[]")
|
readme.write_text("[]")
|
||||||
monkeypatch.chdir(tmp_path)
|
monkeypatch.chdir(tmp_path)
|
||||||
badges_dir = tmp_path / ".badges"
|
badges_dir = tmp_path / ".badges"
|
||||||
badges_dir.mkdir(exist_ok=True)
|
badges_dir.mkdir(exist_ok=True)
|
||||||
@@ -171,7 +171,7 @@ class TestUpdateReadmeWithBadgeSha:
|
|||||||
|
|
||||||
def test_version_verification_no_badges_dir(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_version_verification_no_badges_dir(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
readme = tmp_path / "README.md"
|
readme = tmp_path / "README.md"
|
||||||
readme.write_text("[]")
|
readme.write_text("[]")
|
||||||
monkeypatch.chdir(tmp_path)
|
monkeypatch.chdir(tmp_path)
|
||||||
# No .badges/version.svg exists — should skip verification gracefully
|
# No .badges/version.svg exists — should skip verification gracefully
|
||||||
with patch("subprocess.run"):
|
with patch("subprocess.run"):
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ from devx.tools.setup_image import (
|
|||||||
class TestBuildPipExtraIndexUrl:
|
class TestBuildPipExtraIndexUrl:
|
||||||
def test_basic_url(self) -> None:
|
def test_basic_url(self) -> None:
|
||||||
url = _build_pip_extra_index_url(
|
url = _build_pip_extra_index_url(
|
||||||
"git.oblachno.oblachno.fyi",
|
"git.oblachno.fyi",
|
||||||
"oblachno-oss",
|
"oblachno-oss",
|
||||||
"emil",
|
"emil",
|
||||||
"tok123",
|
"tok123",
|
||||||
)
|
)
|
||||||
assert url == "https://emil:tok123@git.oblachno.oblachno.fyi/api/packages/oblachno-oss/pypi/simple/"
|
assert url == "https://emil:tok123@git.oblachno.fyi/api/packages/oblachno-oss/pypi/simple/"
|
||||||
|
|
||||||
def test_custom_host_org(self) -> None:
|
def test_custom_host_org(self) -> None:
|
||||||
url = _build_pip_extra_index_url(
|
url = _build_pip_extra_index_url(
|
||||||
@@ -233,7 +233,7 @@ class TestCli:
|
|||||||
assert call_args[0] == ".venv"
|
assert call_args[0] == ".venv"
|
||||||
assert call_args[1] == "/opt/venv"
|
assert call_args[1] == "/opt/venv"
|
||||||
assert call_args[2] == "" # no extras
|
assert call_args[2] == "" # no extras
|
||||||
assert call_args[3] == "git.oblachno.oblachno.fyi"
|
assert call_args[3] == "git.oblachno.fyi"
|
||||||
assert call_args[4] == "oblachno-oss"
|
assert call_args[4] == "oblachno-oss"
|
||||||
|
|
||||||
@patch("devx.tools.setup_image._fallback_to_setup_ci")
|
@patch("devx.tools.setup_image._fallback_to_setup_ci")
|
||||||
|
|||||||
Reference in New Issue
Block a user