| from src.bucket import summarize_run_bundle |
| from src.view_models import build_run_view_model |
| import app |
|
|
|
|
| def test_bucket_artifact_tree_url_has_no_main_segment(): |
| url = app._run_artifacts_url("gist-20260602-120645-a145824d", "fffiloni/space-factory-runs") |
| assert url == "https://huggingface.co/buckets/fffiloni/space-factory-runs/tree/runs/gist-20260602-120645-a145824d" |
| assert "/tree/main/runs/" not in url |
|
|
|
|
| def test_run_summary_artifact_url_has_no_main_segment(): |
| summary = summarize_run_bundle( |
| "run-launch", |
| {"state": {"status": "running"}, "launch": {}, "summary_file": {}}, |
| bucket_source="user/space-factory-runs", |
| ) |
| assert summary["artifacts_url"] == "https://huggingface.co/buckets/user/space-factory-runs/tree/runs/run-launch" |
|
|
|
|
| def test_view_model_artifact_url_has_no_main_segment(): |
| bundle = { |
| "summary": {"status": "running", "created_at": "2026-06-02T12:00:00+00:00"}, |
| "state": {}, |
| "launch": {"status": "running"}, |
| "events": [], |
| } |
| view = build_run_view_model("run-launch", bundle, bucket_source="user/space-factory-runs") |
| assert view["links"]["artifacts_url"] == "https://huggingface.co/buckets/user/space-factory-runs/tree/runs/run-launch" |
|
|