This commit is contained in:
Shubhankar45
2026-10-27 12:03:31 +00:00
parent 2ed3945b5d
commit 4e5e95775d
104 changed files with 5210 additions and 606 deletions
+3 -4
View File
@@ -32,7 +32,7 @@ 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.
forms = _by_table(await client.get(f"{API}/approvals", headers=auth["mr1"]))
assert set(forms) == {"tour_plan", "standard_tour_plan", "fare_chart"}
assert set(forms) == {"tour_plan", "standard_tour_plan", "fare_chart", "expense_statement"}
assert {f["status"] for f in forms.values()} == {"draft"}
for who in ("am1", "admin"):
resp = await client.get(f"{API}/approvals", headers=auth[who])
@@ -94,10 +94,9 @@ class TestFormApproval:
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.
# Deleting a row is admin-only — an MR can no longer delete their own rows.
# 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 == 403
assert (await client.delete(f"{API}/fare_chart/rows/{row_id}", headers=auth["admin"])).status_code == 204
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
async def test_the_pdf_signature_comes_from_the_server_not_the_browser(self, client, auth, org, db, fare_chart):