48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
APP = (ROOT / "app" / "web_app_fastapi.py").read_text(encoding="utf-8")
|
|
INDEX = (ROOT / "app" / "templates" / "index.html").read_text(encoding="utf-8")
|
|
ADMIN = (ROOT / "app" / "templates" / "admin_tools.html").read_text(encoding="utf-8")
|
|
COMPOSE = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
|
|
|
|
|
|
def test_upload_endpoints_accept_profile_id_and_keep_os_type():
|
|
assert APP.count("profile_id: Optional[str] = Form(None)") >= 3
|
|
assert "resolve_audit_profile(os_type=os_type, profile_id=profile_id)" in APP
|
|
assert '"os_type": os_type' in APP
|
|
|
|
|
|
def test_v2_registry_routes_and_admin_mutations_exist():
|
|
for route in [
|
|
"/api/v2/registry",
|
|
"/api/v2/profiles/active",
|
|
"/api/v2/admin/categories",
|
|
"/api/v2/admin/components",
|
|
"/api/v2/admin/profiles",
|
|
"/versions/{version}/activate",
|
|
"/rollback",
|
|
]:
|
|
assert route in APP
|
|
assert "_admin_or_403(request)" in APP
|
|
|
|
|
|
def test_audit_form_supports_category_component_profile_selection():
|
|
assert 'id="profile_category"' in INDEX
|
|
assert 'id="profile_component"' in INDEX
|
|
assert 'name="profile_id"' in INDEX
|
|
assert "refreshComponents" in INDEX
|
|
assert "refreshProfiles" in INDEX
|
|
|
|
|
|
def test_admin_ui_supports_registry_version_lifecycle():
|
|
assert "Registry Category → Component → Profile → Version" in ADMIN
|
|
assert "registry_upload_version_v2" in ADMIN
|
|
assert "registry_activate_v2" in ADMIN
|
|
assert "registry_rollback_v2" in ADMIN
|
|
|
|
|
|
def test_registry_has_dedicated_persistent_mount():
|
|
assert "./registry:/app/registry" in COMPOSE
|
|
assert "AUDIT_REGISTRY_ROOT=/app/registry" in COMPOSE
|