File size: 2,257 Bytes
9afe3e0 fab8b21 9afe3e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | from pathlib import Path
from src.bucket import summarize_run_bundle
from src.view_models import build_run_view_model
def test_summary_reconstructs_job_url_from_summary_job_id_and_bucket_owner():
bundle = {
"summary_file": {"job_id": "abc123", "status": "running", "target_space": "fffiloni/demo"},
"launch": {},
"state": {},
"inference_gate": {},
"generation_smoke": {},
"hardware_strategy": {},
}
summary = summarize_run_bundle("run-1", bundle, bucket_source="fffiloni/space-factory-runs")
assert summary["job_url"] == "https://huggingface.co/jobs/fffiloni/abc123"
def test_view_model_reconstructs_job_url_from_job_id_and_bucket_owner():
bundle = {
"summary": {
"run_id": "run-1",
"job_id": "job789",
"status": "running",
"target_space": "fffiloni/demo",
"target_space_url": "https://huggingface.co/spaces/fffiloni/demo",
"artifacts_url": "https://huggingface.co/buckets/fffiloni/space-factory-runs/tree/runs/run-1",
},
"state": {},
"launch": {},
"events": [],
"generation_smoke": {},
"inference_gate": {},
"hardware_strategy": {},
"technical_blockers": {},
}
view = build_run_view_model("run-1", bundle, bucket_source="fffiloni/space-factory-runs")
assert view["links"]["job_url"] == "https://huggingface.co/jobs/fffiloni/job789"
assert view["status_model"]["has_job_url"] is True
def test_frontend_job_fallback_uses_bucket_owner_and_created_by():
app_js = Path("web/static/app.js").read_text(encoding="utf-8")
runs_js = Path("web/static/runs.js").read_text(encoding="utf-8")
assert "ownerFromBucketSource" in app_js
assert "out.created_by" in app_js
assert "inferredOwnerFromBucket" in runs_js
assert "summary.created_by" in runs_js
assert "detail.bucket_source" in runs_js
def test_responsive_breakpoints_are_less_aggressive():
css = Path("web/static/app.css").read_text(encoding="utf-8")
assert "@media (max-width: 1180px)" in css
assert "@media (max-width: 720px)" in css
assert "@media (max-width: 1260px)" not in css
assert "@media (max-width: 860px)" not in css
|