Upload 135 files
Browse files
tests/test_v132_prescan_output_type_sync.py
CHANGED
|
@@ -37,4 +37,5 @@ def test_prescan_ui_syncs_expected_output_type_when_clear():
|
|
| 37 |
assert "function syncExpectedOutputFromModelScan" in app
|
| 38 |
assert "syncExpectedOutputFromModelScan(result)" in app
|
| 39 |
assert "$('buildExpectedOutput')" in app
|
| 40 |
-
assert "
|
|
|
|
|
|
| 37 |
assert "function syncExpectedOutputFromModelScan" in app
|
| 38 |
assert "syncExpectedOutputFromModelScan(result)" in app
|
| 39 |
assert "$('buildExpectedOutput')" in app
|
| 40 |
+
assert "outputTypeFromModelScan(scan)" in app
|
| 41 |
+
assert "Output',outputType" in app
|
tests/test_v185_model_prescan_all_states.py
CHANGED
|
@@ -18,7 +18,7 @@ def test_prescan_renderer_keeps_all_verdicts_in_same_compact_system():
|
|
| 18 |
assert f"{verdict}:" in APP_JS or f"verdict==='{verdict}'" in APP_JS
|
| 19 |
assert "prescan-compact-grid" in APP_JS
|
| 20 |
assert "prescan-pill-row" in APP_JS
|
| 21 |
-
assert "prescan-
|
| 22 |
|
| 23 |
|
| 24 |
def test_prescan_css_has_state_specific_compact_surfaces():
|
|
@@ -29,8 +29,8 @@ def test_prescan_css_has_state_specific_compact_surfaces():
|
|
| 29 |
".model-prescan-card.error",
|
| 30 |
".model-prescan-card.success",
|
| 31 |
".prescan-pill.running",
|
| 32 |
-
".prescan-
|
| 33 |
-
".prescan-
|
| 34 |
]:
|
| 35 |
assert selector in APP_CSS
|
| 36 |
assert "@keyframes prescan-spin" in APP_CSS
|
|
|
|
| 18 |
assert f"{verdict}:" in APP_JS or f"verdict==='{verdict}'" in APP_JS
|
| 19 |
assert "prescan-compact-grid" in APP_JS
|
| 20 |
assert "prescan-pill-row" in APP_JS
|
| 21 |
+
assert "prescan-decision-line" in APP_JS
|
| 22 |
|
| 23 |
|
| 24 |
def test_prescan_css_has_state_specific_compact_surfaces():
|
|
|
|
| 29 |
".model-prescan-card.error",
|
| 30 |
".model-prescan-card.success",
|
| 31 |
".prescan-pill.running",
|
| 32 |
+
".prescan-decision-line.warn",
|
| 33 |
+
".prescan-decision-line.error",
|
| 34 |
]:
|
| 35 |
assert selector in APP_CSS
|
| 36 |
assert "@keyframes prescan-spin" in APP_CSS
|
tests/test_v186_eval_archive_and_prescan_polish.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 4 |
+
APP_JS = (ROOT / "web" / "static" / "app.js").read_text()
|
| 5 |
+
APP_CSS = (ROOT / "web" / "static" / "app.css").read_text()
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def test_eval_archive_actions_have_breathing_room():
|
| 9 |
+
assert ".eval-archive-actions" in APP_CSS
|
| 10 |
+
assert "padding-top:12px" in APP_CSS
|
| 11 |
+
assert "border-top:1px solid" in APP_CSS
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def test_prescan_success_uses_decision_summary_not_full_report():
|
| 15 |
+
assert "prescan-decision-line" in APP_JS
|
| 16 |
+
assert "allGood.length" in APP_JS
|
| 17 |
+
assert "No risk signals" in APP_JS
|
| 18 |
+
assert "goodPreview=(verdict!=='safe'" in APP_JS
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_prescan_decision_line_has_state_styles():
|
| 22 |
+
for selector in [
|
| 23 |
+
".prescan-decision-line.success",
|
| 24 |
+
".prescan-decision-line.warn",
|
| 25 |
+
".prescan-decision-line.error",
|
| 26 |
+
".prescan-decision-line.running",
|
| 27 |
+
]:
|
| 28 |
+
assert selector in APP_CSS
|
tests/test_v187_public_eval_archive_status.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def test_eval_archive_status_endpoint_is_public_readonly():
|
| 5 |
+
app = Path('app.py').read_text()
|
| 6 |
+
assert '@fastapi_app.get("/api/eval-archive/status")' in app
|
| 7 |
+
block = app.split('@fastapi_app.get("/api/eval-archive/status")', 1)[1].split('@fastapi_app.post("/api/eval-archive/activate")', 1)[0]
|
| 8 |
+
assert 'except HTTPException' in block
|
| 9 |
+
assert 'return JSONResponse(public_eval_config(username))' in block
|
| 10 |
+
assert 'ctx = _oauth_context_from_request(request)' in block
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def test_signed_out_ui_fetches_public_eval_archive_status():
|
| 14 |
+
js = Path('web/static/app.js').read_text()
|
| 15 |
+
assert "async function refreshAnonymousEvalStatus()" in js
|
| 16 |
+
assert "apiGet('/api/eval-archive/status')" in js
|
| 17 |
+
catch_block = js.split('catch(e){state.user=null;', 1)[1].split("setText('userChip'", 1)[0]
|
| 18 |
+
assert 'await refreshAnonymousEvalStatus();' in catch_block
|
| 19 |
+
assert 'renderAnonymousEvalStatus(null)' not in catch_block
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_eval_archive_management_still_requires_oauth_context():
|
| 23 |
+
app = Path('app.py').read_text()
|
| 24 |
+
activate_block = app.split('@fastapi_app.post("/api/eval-archive/activate")', 1)[1].split('@fastapi_app.post("/api/eval-archive/disable")', 1)[0]
|
| 25 |
+
disable_block = app.split('@fastapi_app.post("/api/eval-archive/disable")', 1)[1].split('@fastapi_app.get("/api/oauth/diagnostics")', 1)[0]
|
| 26 |
+
assert 'ctx = _oauth_context_from_request(request)' in activate_block
|
| 27 |
+
assert 'ctx = _oauth_context_from_request(request)' in disable_block
|