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:
Shubhankar45
2026-11-07 05:43:12 +00:00
parent b001e2d03c
commit 0d30c58bf0
98 changed files with 1878 additions and 573 deletions
+13 -13
View File
@@ -14,40 +14,40 @@ from app.common.exceptions import (
class TestHappyPath:
def test_mr_submits_draft(self):
t = assert_transition(DCRStatus.DRAFT, WorkflowAction.SUBMIT, Role.MR)
assert t.to_status == DCRStatus.PENDING_AM
assert t.to_status == DCRStatus.PENDING_ABM
def test_mr_resubmits_returned(self):
t = assert_transition(DCRStatus.RETURNED, WorkflowAction.SUBMIT, Role.MR)
assert t.to_status == DCRStatus.PENDING_AM
assert t.to_status == DCRStatus.PENDING_ABM
def test_am_approves(self):
t = assert_transition(DCRStatus.PENDING_AM, WorkflowAction.APPROVE, Role.AM)
t = assert_transition(DCRStatus.PENDING_ABM, WorkflowAction.APPROVE, Role.ABM)
assert t.to_status == DCRStatus.APPROVED
def test_am_returns_requires_reason(self):
t = assert_transition(DCRStatus.PENDING_AM, WorkflowAction.RETURN, Role.AM)
t = assert_transition(DCRStatus.PENDING_ABM, WorkflowAction.RETURN, Role.ABM)
assert t.to_status == DCRStatus.RETURNED
assert t.requires_reason is True
def test_gm_cannot_approve_or_return(self):
for action in (WorkflowAction.APPROVE, WorkflowAction.RETURN):
with pytest.raises(ForbiddenError):
assert_transition(DCRStatus.PENDING_AM, action, Role.GM)
assert_transition(DCRStatus.PENDING_ABM, action, Role.AGM)
class TestAreaManagerIsTheFinalApprover:
"""There is no General Manager stage: the AM approves or returns."""
"""There is no AGM stage: the ABM approves or returns."""
def test_no_general_manager_status_or_action_exists(self):
assert "PENDING_GM" not in {s.value for s in DCRStatus}
assert "FORWARD" not in {a.value for a in WorkflowAction}
assert not [t for t in TRANSITIONS if t.allowed_role == Role.GM]
assert not [t for t in TRANSITIONS if t.allowed_role == Role.AGM]
def test_only_the_area_manager_can_decide_a_pending_report(self):
for role in (Role.MR, Role.GM, Role.ADMIN):
for role in (Role.MR, Role.AGM, Role.ADMIN):
for action in (WorkflowAction.APPROVE, WorkflowAction.RETURN):
with pytest.raises(ForbiddenError):
assert_transition(DCRStatus.PENDING_AM, action, role)
assert_transition(DCRStatus.PENDING_ABM, action, role)
class TestAdminCanNeverApprove:
@@ -80,7 +80,7 @@ class TestEditability:
def test_editable(self, status):
assert_editable(status) # must not raise
@pytest.mark.parametrize("status", [DCRStatus.PENDING_AM, DCRStatus.APPROVED])
@pytest.mark.parametrize("status", [DCRStatus.PENDING_ABM, DCRStatus.APPROVED])
def test_not_editable(self, status):
with pytest.raises(ReportLockedError):
assert_editable(status)
@@ -89,11 +89,11 @@ class TestEditability:
class TestWrongRoleAtRightStage:
def test_mr_cannot_approve(self):
with pytest.raises(ForbiddenError):
assert_transition(DCRStatus.PENDING_AM, WorkflowAction.APPROVE, Role.MR)
assert_transition(DCRStatus.PENDING_ABM, WorkflowAction.APPROVE, Role.MR)
def test_gm_cannot_submit(self):
with pytest.raises(ForbiddenError):
assert_transition(DCRStatus.DRAFT, WorkflowAction.SUBMIT, Role.GM)
assert_transition(DCRStatus.DRAFT, WorkflowAction.SUBMIT, Role.AGM)
def test_mr_cannot_return_its_own_report(self):
with pytest.raises(InvalidStateTransitionError):
@@ -101,6 +101,6 @@ class TestWrongRoleAtRightStage:
def test_exactly_four_transitions():
"""submit (x2), then the Area Manager approves or returns."""
"""submit (x2), then the Area Business Manager approves or returns."""
assert len(TRANSITIONS) == 4
assert len(DCRStatus) == 4