Server backup 2026-11-07 of uncommitted work in projects/pharma-web-celtic
Snapshot of the working tree on srv1071960 (branch main), taken during server cleanup. .env files, node_modules, builds, logs and media were excluded.
This commit is contained in:
@@ -30,7 +30,7 @@ def _by_table(resp):
|
||||
|
||||
class TestFormApproval:
|
||||
async def test_every_approval_form_starts_as_draft_for_everyone(self, client, auth):
|
||||
# An MR sees all three forms as drafts; an Area Manager or admin has nothing to act on yet.
|
||||
# An MR sees all three forms as drafts; an Area Business Manager or admin has nothing to act on yet.
|
||||
forms = _by_table(await client.get(f"{API}/approvals", headers=auth["mr1"]))
|
||||
assert set(forms) == {"tour_plan", "standard_tour_plan", "fare_chart", "expense_statement"}
|
||||
assert {f["status"] for f in forms.values()} == {"draft"}
|
||||
@@ -47,7 +47,7 @@ class TestFormApproval:
|
||||
done = await client.post(f"{API}/fare_chart/approval/approve?owner_id={org['mr1'].id}", headers=auth["am1"])
|
||||
assert done.status_code == 200, done.text
|
||||
assert done.json()["status"] == "approved" and done.json()["approved_by_name"] == "Suresh Behera"
|
||||
# The MR's very next read shows the AM's approval — no shared browser needed.
|
||||
# The MR's very next read shows the ABM's approval — no shared browser needed.
|
||||
seen = _by_table(await client.get(f"{API}/approvals", headers=auth["mr1"]))["fare_chart"]
|
||||
assert (seen["status"], seen["approved_by_name"]) == ("approved", "Suresh Behera")
|
||||
|
||||
@@ -61,7 +61,7 @@ class TestFormApproval:
|
||||
early = await client.post(f"{API}/fare_chart/approval/approve?owner_id={org['mr1'].id}", headers=auth["am1"])
|
||||
assert early.status_code == 409, early.text
|
||||
assert _by_table(await client.get(f"{API}/approvals", headers=auth["mr1"]))["fare_chart"]["status"] == "draft"
|
||||
assert (await client.get(f"{API}/approvals", headers=auth["am1"])).json() == [] # a draft is nothing for the AM to act on
|
||||
assert (await client.get(f"{API}/approvals", headers=auth["am1"])).json() == [] # a draft is nothing for the ABM to act on
|
||||
|
||||
async def test_double_clicks_are_harmless(self, client, auth, org, fare_chart):
|
||||
await _add_row(client, auth)
|
||||
@@ -93,11 +93,11 @@ class TestFormApproval:
|
||||
assert (await change()).status_code in (200, 201)
|
||||
state = _by_table(await client.get(f"{API}/approvals", headers=auth["mr1"]))["fare_chart"]
|
||||
assert state["status"] == "draft" and state["approved_by_name"] is None
|
||||
# A pending (not yet approved) form is withdrawn too, so the AM never signs stale data.
|
||||
# A pending (not yet approved) form is withdrawn too, so the ABM never signs stale data.
|
||||
# An MR may remove a row they entered by mistake; that too withdraws the request.
|
||||
await client.post(f"{API}/fare_chart/approval/request", headers=auth["mr1"])
|
||||
assert (await client.delete(f"{API}/fare_chart/rows/{row_id}", headers=auth["mr1"])).status_code == 204
|
||||
assert (await client.get(f"{API}/approvals", headers=auth["am1"])).json() == [] # withdrawn: nothing left for the AM
|
||||
assert (await client.get(f"{API}/approvals", headers=auth["am1"])).json() == [] # withdrawn: nothing left for the ABM
|
||||
|
||||
async def test_the_pdf_signature_comes_from_the_server_not_the_browser(self, client, auth, org, db, fare_chart):
|
||||
# Not approved: a browser claiming otherwise changes nothing.
|
||||
|
||||
Reference in New Issue
Block a user