Files
portfolio-hub/tests/test_auth_surface_after_client_deprecation.py
T

50 lines
2.3 KiB
Python

"""REQ-016: client token 발급 경로 폐지 후 표면 검증 (AC-1, AC-4)."""
from __future__ import annotations
import subprocess
# REQ-016 AC-1: 후보 소스에 issue_client_token / CreateClientTokenRequest / IssuedClientTokenResponse 잔여 없음
def _source_symbol_matches(symbol: str) -> list[str]:
result = subprocess.run(
["grep", "-r", "--exclude-dir=temp", "--exclude-dir=.git", "--exclude-dir=.venv", "--include=*.py", "-l", symbol],
capture_output=True,
check=False,
text=True,
cwd=str(__import__("pathlib").Path(__file__).parent.parent),
)
return [line for line in result.stdout.splitlines() if not line.startswith("tests/test_auth_surface")]
def test_no_issue_client_token_symbol_in_codebase() -> None:
matches = _source_symbol_matches("issue_client_token")
assert matches == [], f"issue_client_token 잔여 참조 발견: {matches}"
def test_no_create_client_token_request_symbol_in_codebase() -> None:
matches = _source_symbol_matches("CreateClientTokenRequest")
assert matches == [], f"CreateClientTokenRequest 잔여 참조 발견: {matches}"
def test_no_issued_client_token_response_symbol_in_codebase() -> None:
matches = _source_symbol_matches("IssuedClientTokenResponse")
assert matches == [], f"IssuedClientTokenResponse 잔여 참조 발견: {matches}"
# REQ-016 AC-4: dcy-003 token_type 게이트 — client token 발급 불가에 따른 회귀 없음
# (token_type='client' 게이트 자체는 유지: dcy-003 OQ-5)
def test_client_token_type_not_importable_from_auth_service() -> None:
import importlib
module = importlib.import_module("app.services.auth_service")
assert not hasattr(module, "IssuedClientToken"), "IssuedClientToken이 auth_service에 잔존합니다"
assert not hasattr(module.AuthService, "issue_client_token"), "issue_client_token 메서드가 잔존합니다"
def test_client_token_request_not_importable_from_schemas() -> None:
import importlib
module = importlib.import_module("app.schemas.auth")
assert not hasattr(module, "CreateClientTokenRequest"), "CreateClientTokenRequest가 schemas/auth에 잔존합니다"
assert not hasattr(module, "IssuedClientTokenResponse"), "IssuedClientTokenResponse가 schemas/auth에 잔존합니다"