Spaces:
Sleeping
Sleeping
Commit ·
bcf7de3
1
Parent(s): 1508261
Test Zorgfilter Hugging Face sync verification evidence
Browse files
tests/test_care_profile_hf_sync_verification.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 6 |
+
REPORT_PATH = ROOT / "output" / "validation" / "care_profile_hf_sync_verification.json"
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def _report():
|
| 10 |
+
return json.loads(REPORT_PATH.read_text(encoding="utf-8"))
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def test_hugging_face_sync_evidence_is_complete_and_green():
|
| 14 |
+
report = _report()
|
| 15 |
+
|
| 16 |
+
assert report["schema_version"] == "1.1"
|
| 17 |
+
assert report["github_ref"] == "main"
|
| 18 |
+
assert report["github_commit"] == "cca4a25aaff28a7ba647c961d8e50f0e076921e2"
|
| 19 |
+
assert report["hugging_face_space"] == "solidprivacy/scrub"
|
| 20 |
+
assert report["checked_file_count"] == 12
|
| 21 |
+
assert report["exact_matching_file_count"] == 12
|
| 22 |
+
assert report["verified_file_count"] == 12
|
| 23 |
+
assert report["all_files_exact_match"] is True
|
| 24 |
+
assert report["all_markers_match"] is True
|
| 25 |
+
assert report["space_health"]["healthy"] is True
|
| 26 |
+
assert report["space_health"]["attempts"][0]["http_status"] == 200
|
| 27 |
+
assert report["space_health"]["attempts"][0]["body"] == "ok"
|
| 28 |
+
assert report["space_health"]["root_http_status"] == 200
|
| 29 |
+
assert report["sync_verified"] is True
|
| 30 |
+
assert report["technical_deployment_verified"] is True
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def test_app_verification_remains_open_until_user_confirmation():
|
| 34 |
+
report = _report()
|
| 35 |
+
|
| 36 |
+
assert report["functional_app_verification"] is False
|
| 37 |
+
assert (
|
| 38 |
+
report["functional_app_verification_status"]
|
| 39 |
+
== "pending_coordinator_user_confirmation"
|
| 40 |
+
)
|
| 41 |
+
assert report["human_review_required"] is True
|
| 42 |
+
assert report["production_ready"] is False
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def test_sync_report_contains_no_embedded_credentials_or_private_data():
|
| 46 |
+
report_text = REPORT_PATH.read_text(encoding="utf-8")
|
| 47 |
+
lowered = report_text.lower()
|
| 48 |
+
|
| 49 |
+
forbidden = (
|
| 50 |
+
"authorization:",
|
| 51 |
+
"bearer ",
|
| 52 |
+
"hf_token",
|
| 53 |
+
"github_token",
|
| 54 |
+
"access_token",
|
| 55 |
+
"patient name",
|
| 56 |
+
"real personal data",
|
| 57 |
+
)
|
| 58 |
+
assert not any(value in lowered for value in forbidden)
|
| 59 |
+
|
| 60 |
+
report = json.loads(report_text)
|
| 61 |
+
for item in report["files"]:
|
| 62 |
+
assert item["http_status"] == 200
|
| 63 |
+
assert item["exact_match"] is True
|
| 64 |
+
assert item["markers_match"] is True
|
| 65 |
+
assert item["verified"] is True
|
| 66 |
+
assert item["local_sha256"] == item["remote_sha256"]
|