Skip to content

Commit 7e4ee52

Browse files
josbellclaude
andcommitted
test: add MSW handler and non-budget-team test for pending requisitions
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7c4a5eb commit 7e4ee52

5 files changed

Lines changed: 127 additions & 125 deletions

File tree

backend/ops_api/Pipfile.lock

Lines changed: 56 additions & 121 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/ops_api/tests/ops/procurement_tracker/test_budget_team_requisition_review_card.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,25 @@ def test_get_pending_requisitions_excludes_completed(
9393

9494

9595
def test_get_pending_requisitions_filters_by_budget_team_role(client, test_budget_team_requisition_step, loaded_db):
96-
"""Only BUDGET_TEAM role users get results."""
97-
# Non-budget-team user should get empty list
98-
# Note: This test would need proper auth setup for a non-budget-team user
99-
# For now, just verify the endpoint requires auth
96+
"""Unauthenticated users get 401."""
10097
response = client.get("/api/v1/procurement-tracker-steps/pending-requisitions/")
10198
assert response.status_code == 401 # Unauthenticated
10299

103100

101+
def test_get_pending_requisitions_non_budget_team_gets_empty_list(
102+
basic_user_auth_client, test_budget_team_requisition_step, loaded_db
103+
):
104+
"""Authenticated non-budget-team users get empty list, not 401."""
105+
# Make request as basic user (not budget team)
106+
response = basic_user_auth_client.get("/api/v1/procurement-tracker-steps/pending-requisitions/")
107+
assert response.status_code == 200
108+
109+
data = response.json
110+
assert isinstance(data, list)
111+
# Non-budget-team user should see empty list
112+
assert len(data) == 0
113+
114+
104115
def test_get_pending_requisitions_includes_agreement_data(
105116
budget_team_auth_client, test_budget_team_requisition_step, loaded_db
106117
):

frontend/src/components/ChangeRequests/BudgetTeamRequisitionReviewCard/BudgetTeamRequisitionReviewCard.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
1010
/**
1111
* BudgetTeamRequisitionReviewCard component for displaying pending budget team requisition reviews
1212
* Appears after Division Director approval, prompts budget team to enter requisition details
13+
*
14+
* NOTE: This component does NOT use the shared ReviewCard base component because it serves a different
15+
* purpose than change request cards. ReviewCard is designed for inline approve/reject actions on
16+
* change requests, while this card (like PreAwardReviewCard) is an informational card that links
17+
* to a detail page. The card structure is intentionally customized to show budget-specific metadata.
18+
*
1319
* @component
1420
* @param {Object} props - Properties passed to component
1521
* @param {number} props.agreementId - The ID of the agreement

frontend/src/components/ChangeRequests/PreAwardReviewCard/PreAwardReviewCard.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
1010

1111
/**
1212
* PreAwardReviewCard component for displaying pending pre-award approval requests
13+
*
14+
* NOTE: This component does NOT use the shared ReviewCard base component because it serves a different
15+
* purpose than change request cards. ReviewCard is designed for inline approve/reject actions on
16+
* change requests, while this card (like BudgetTeamRequisitionReviewCard) is an informational card
17+
* that links to a detail/approval page.
18+
*
1319
* @component
1420
* @param {Object} props - Properties passed to component
1521
* @param {number} props.agreementId - The ID of the agreement

0 commit comments

Comments
 (0)