Evidence export of closed runs and rtut seal (RBT-WP-0009-T04)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: sonnet
Assistant-Process: 295952@bnt-lap001
Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
This commit is contained in:
tegwick 2026-09-29 21:35:03 +02:00
parent e021fd979f
commit 6d70f4d97d
12 changed files with 149 additions and 19 deletions

View file

@ -228,3 +228,20 @@ def test_sidebar_marks_projects_on_a_project_run_page_and_csrf_and_unknown_ids(s
assert req(srv, "POST", "/project/demo/runall", {"mode": "manual"})[0] == 403
assert req(srv, "GET", "/project-run/nope")[0] == 404
assert post(srv, "/project-run/nope/tick", n="1")[0] == 400
def test_a_closed_project_run_record_can_be_downloaded(srv):
import json
from rtut import run as RR
loc = start_pr(srv)
c = http.client.HTTPConnection("127.0.0.1", srv.server_address[1])
c.request("GET", f"{loc}/record.json", None, {"Host": "127.0.0.1"})
assert c.getresponse().status == 409 # open: no final record yet
post(srv, f"{loc}/finalize", outcome="abandoned")
assert f"<a href='{loc}/record.json'>Download the project run record (JSON)</a>" in req(srv, "GET", loc)[2]
c = http.client.HTTPConnection("127.0.0.1", srv.server_address[1])
c.request("GET", f"{loc}/record.json", None, {"Host": "127.0.0.1"})
r = c.getresponse(); body = r.read()
assert r.status == 200 and r.getheader("X-Rtut-Seal") == "sealed" and "attachment" in r.getheader("Content-Disposition")
rec = json.loads(body)
assert rec["project"] == "demo" and rec["outcome"] == "abandoned" and RR.record_seal_state(rec) == "sealed"