Files
ss-tools/backend/tests/api/test_git_deps.py
root 632b730fff chore: migrate GRACE-Poly anchors to hierarchical dotted naming
Systematic rename of all semantic anchors (#region, [DEF], @RELATION)
across 1400+ files — backend Python, frontend Svelte/TS, specs, docs:
- Flat anchors become Namespace.Module.Entity
- @RELATION references updated to match new anchor paths
- Zero business logic changes
2026-07-22 11:48:15 +03:00

42 lines
1.3 KiB
Python

# #region Test.Api.GitDeps [C:2] [TYPE Module] [SEMANTICS test,git,deps]
# @BRIEF Unit tests for git dependency helper.
# @RELATION BINDS_TO -> [Api.Deps.GitDeps]
# @TEST_EDGE: monkeypatch_resolution
import sys
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
_src = str(Path(__file__).resolve().parent.parent.parent / "src")
if _src not in sys.path:
sys.path.insert(0, _src)
class TestGetGitService:
"""get_git_service resolves from sys.modules at call time."""
def test_get_git_service_resolves_correctly(self):
"""Verify it resolves from sys.modules."""
import sys as sys_mod
from src.api.routes.git._deps import get_git_service
from src.api.routes import git as git_routes
mock_service = MagicMock()
# Monkeypatch via sys.modules
sys_mod.modules["src.api.routes.git"].git_service = mock_service
try:
result = get_git_service()
assert result is mock_service
finally:
# Restore
sys_mod.modules["src.api.routes.git"].git_service = git_routes.git_service
def test_max_repository_status_batch(self):
"""Guard value is 50."""
from src.api.routes.git._deps import MAX_REPOSITORY_STATUS_BATCH
assert MAX_REPOSITORY_STATUS_BATCH == 50
# #endregion Test.Api.GitDeps