Skip to content

Commit

Permalink
Merge pull request #3159 from HHS/OPS-3111/update-division-director-role
Browse files Browse the repository at this point in the history
Ops 3111/update division director role
  • Loading branch information
johndeange authored Dec 4, 2024
2 parents 8c1c096 + f593e99 commit eaf21ce
Show file tree
Hide file tree
Showing 21 changed files with 803 additions and 716 deletions.
26 changes: 8 additions & 18 deletions backend/data_tools/data/user_data.json5
Original file line number Diff line number Diff line change
Expand Up @@ -157,32 +157,19 @@
"PATCH_UPLOAD_DOCUMENT"
],
},
{ // 3 Division Director
name: "division-director",
{ // 3 Reviewer/Approver
name: "REVIEWER_APPROVER",
permissions: [
"GET_AGREEMENT",
"PUT_AGREEMENT",
"PATCH_AGREEMENT",
"POST_AGREEMENT",
// Delete permissions are only for local, not for prod. Users should not have delete Agreement permissions in prod.
"DELETE_AGREEMENT",

"GET_BUDGET_LINE_ITEM",
"PUT_BUDGET_LINE_ITEM",
"PATCH_BUDGET_LINE_ITEM",
"POST_BUDGET_LINE_ITEM",
// Delete permissions are only for local, not for prod. Users should not have delete BLI permissions in prod.
"DELETE_BUDGET_LINE_ITEM",

"GET_SERVICES_COMPONENT",
"PUT_SERVICES_COMPONENT",
"PATCH_SERVICES_COMPONENT",
"POST_SERVICES_COMPONENT",

"GET_BLI_PACKAGE",
"PUT_BLI_PACKAGE",
"PATCH_BLI_PACKAGE",
"POST_BLI_PACKAGE",

"GET_CAN",

Expand All @@ -204,17 +191,18 @@
"GET_HISTORY",

"GET_WORKFLOW",
"PUT_WORKFLOW",
"PATCH_WORKFLOW",
"POST_WORKFLOW",

"GET_CHANGE_REQUEST",
"PATCH_CHANGE_REQUEST",
"PUT_CHANGE_REQUEST",
"POST_CHANGE_REQUEST",
"DELETE_CHANGE_REQUEST",

"GET_CHANGE_REQUEST_REVIEW",
"PATCH_CHANGE_REQUEST_REVIEW",
"PUT_CHANGE_REQUEST_REVIEW",
"POST_CHANGE_REQUEST_REVIEW",
"DELETE_CHANGE_REQUEST_REVIEW",

"GET_UPLOAD_DOCUMENT",
"POST_UPLOAD_DOCUMENT",
Expand All @@ -234,11 +222,13 @@
"PUT_AGREEMENT",
"PATCH_AGREEMENT",
"POST_AGREEMENT",
"DELETE_AGREEMENT",

"GET_BUDGET_LINE_ITEM",
"PUT_BUDGET_LINE_ITEM",
"PATCH_BUDGET_LINE_ITEM",
"POST_BUDGET_LINE_ITEM",
"DELETE_BUDGET_LINE_ITEM",

"GET_SERVICES_COMPONENT",
"PUT_SERVICES_COMPONENT",
Expand Down
2 changes: 1 addition & 1 deletion backend/data_tools/initial_data/003-role.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INSERT INTO ops.role (id, name, permissions, created_on, updated_on) VALUES (1, 'SYSTEM_OWNER', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,DELETE_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,PUT_BUDGET_LINE_ITEM,PATCH_BUDGET_LINE_ITEM,POST_BUDGET_LINE_ITEM,DELETE_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,PUT_SERVICES_COMPONENT,PATCH_SERVICES_COMPONENT,POST_SERVICES_COMPONENT,GET_BLI_PACKAGE,PUT_BLI_PACKAGE,PATCH_BLI_PACKAGE,POST_BLI_PACKAGE,GET_CAN,POST_CAN,PATCH_CAN,PUT_CAN,DELETE_CAN,GET_DIVISION,PUT_DIVISION,PATCH_DIVISION,POST_DIVISION,DELETE_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,PUT_PORTFOLIO,PATCH_PORTFOLIO,POST_PORTFOLIO,DELETE_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,PUT_WORKFLOW,PATCH_WORKFLOW,POST_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp);
INSERT INTO ops.role (id, name, permissions, created_on, updated_on) VALUES (2, 'VIEWER_EDITOR', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,GET_BLI_PACKAGE,GET_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp);
INSERT INTO ops.role (id, name, permissions, created_on, updated_on) VALUES (3, 'division-director', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,DELETE_AGREEMENT,GET_BUDGET_LINE_ITEM,PUT_BUDGET_LINE_ITEM,PATCH_BUDGET_LINE_ITEM,POST_BUDGET_LINE_ITEM,DELETE_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,PUT_SERVICES_COMPONENT,PATCH_SERVICES_COMPONENT,POST_SERVICES_COMPONENT,GET_BLI_PACKAGE,PUT_BLI_PACKAGE,PATCH_BLI_PACKAGE,POST_BLI_PACKAGE,GET_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,PUT_WORKFLOW,PATCH_WORKFLOW,POST_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp);
INSERT INTO ops.role (id, name, permissions, created_on, updated_on) VALUES (3, 'REVIEWER_APPROVER', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,GET_BLI_PACKAGE,GET_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,PUT_CHANGE_REQUEST,POST_CHANGE_REQUEST,DELETE_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,PUT_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,DELETE_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp);
INSERT INTO ops.role (id, name, permissions, created_on, updated_on) VALUES (4, 'USER_ADMIN', '{POST_USER}', current_timestamp, current_timestamp);
INSERT INTO ops.role (id, name, permissions, created_on, updated_on) VALUES (5, 'BUDGET_TEAM', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,PUT_BUDGET_LINE_ITEM,PATCH_BUDGET_LINE_ITEM,POST_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,PUT_SERVICES_COMPONENT,PATCH_SERVICES_COMPONENT,POST_SERVICES_COMPONENT,GET_BLI_PACKAGE,PUT_BLI_PACKAGE,PATCH_BLI_PACKAGE,POST_BLI_PACKAGE,GET_CAN,PUT_CAN,PATCH_CAN,POST_CAN,DELETE_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,PUT_PORTFOLIO,PATCH_PORTFOLIO,POST_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,PUT_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_CHANGE_REQUEST,PUT_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PUT_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp);
2 changes: 1 addition & 1 deletion backend/data_tools/initial_data/004-role_version.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INSERT INTO ops.role_version (id, name, permissions, created_on, updated_on, transaction_id, end_transaction_id, operation_type) VALUES (1, 'SYSTEM_OWNER', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,DELETE_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,PUT_BUDGET_LINE_ITEM,PATCH_BUDGET_LINE_ITEM,POST_BUDGET_LINE_ITEM,DELETE_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,PUT_SERVICES_COMPONENT,PATCH_SERVICES_COMPONENT,POST_SERVICES_COMPONENT,GET_BLI_PACKAGE,PUT_BLI_PACKAGE,PATCH_BLI_PACKAGE,POST_BLI_PACKAGE,GET_CAN,POST_CAN,PATCH_CAN,PUT_CAN,DELETE_CAN,GET_DIVISION,PUT_DIVISION,PATCH_DIVISION,POST_DIVISION,DELETE_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,PUT_PORTFOLIO,PATCH_PORTFOLIO,POST_PORTFOLIO,DELETE_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,PUT_WORKFLOW,PATCH_WORKFLOW,POST_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp, 1, null, 0);
INSERT INTO ops.role_version (id, name, permissions, created_on, updated_on, transaction_id, end_transaction_id, operation_type) VALUES (2, 'VIEWER_EDITOR', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,GET_BLI_PACKAGE,GET_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp, 1, null, 0);
INSERT INTO ops.role_version (id, name, permissions, created_on, updated_on, transaction_id, end_transaction_id, operation_type) VALUES (3, 'division-director', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,DELETE_AGREEMENT,GET_BUDGET_LINE_ITEM,PUT_BUDGET_LINE_ITEM,PATCH_BUDGET_LINE_ITEM,POST_BUDGET_LINE_ITEM,DELETE_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,PUT_SERVICES_COMPONENT,PATCH_SERVICES_COMPONENT,POST_SERVICES_COMPONENT,GET_BLI_PACKAGE,PUT_BLI_PACKAGE,PATCH_BLI_PACKAGE,POST_BLI_PACKAGE,GET_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,PUT_WORKFLOW,PATCH_WORKFLOW,POST_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp, 1, null, 0);
INSERT INTO ops.role_version (id, name, permissions, created_on, updated_on, transaction_id, end_transaction_id, operation_type) VALUES (3, 'REVIEWER_APPROVER', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,GET_BLI_PACKAGE,GET_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_WORKFLOW,GET_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,PUT_CHANGE_REQUEST,POST_CHANGE_REQUEST,DELETE_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,PUT_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,DELETE_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT,PATCH_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp, 1, null, 0);
INSERT INTO ops.role_version (id, name, permissions, created_on, updated_on, transaction_id, end_transaction_id, operation_type) VALUES (4, 'USER_ADMIN', '{POST_USER}', current_timestamp, current_timestamp, 1, null, 0);
INSERT INTO ops.role_version (id, name, permissions, created_on, updated_on, transaction_id, end_transaction_id, operation_type) VALUES (5, 'BUDGET_TEAM', '{GET_AGREEMENT,PUT_AGREEMENT,PATCH_AGREEMENT,POST_AGREEMENT,GET_BUDGET_LINE_ITEM,PUT_BUDGET_LINE_ITEM,PATCH_BUDGET_LINE_ITEM,POST_BUDGET_LINE_ITEM,GET_SERVICES_COMPONENT,PUT_SERVICES_COMPONENT,PATCH_SERVICES_COMPONENT,POST_SERVICES_COMPONENT,GET_BLI_PACKAGE,PUT_BLI_PACKAGE,PATCH_BLI_PACKAGE,POST_BLI_PACKAGE,GET_CAN,PUT_CAN,PATCH_CAN,POST_CAN,DELETE_CAN,GET_DIVISION,GET_NOTIFICATION,PUT_NOTIFICATION,PATCH_NOTIFICATION,GET_PORTFOLIO,PUT_PORTFOLIO,PATCH_PORTFOLIO,POST_PORTFOLIO,GET_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,PUT_RESEARCH_PROJECT,POST_RESEARCH_PROJECT,GET_USER,PUT_USER,PATCH_USER,GET_HISTORY,GET_CHANGE_REQUEST,PUT_CHANGE_REQUEST,PATCH_CHANGE_REQUEST,POST_CHANGE_REQUEST,GET_CHANGE_REQUEST_REVIEW,PUT_CHANGE_REQUEST_REVIEW,PATCH_CHANGE_REQUEST_REVIEW,POST_CHANGE_REQUEST_REVIEW,GET_UPLOAD_DOCUMENT,POST_UPLOAD_DOCUMENT}', current_timestamp, current_timestamp, 1, null, 0);
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ def __init__(
"email": "[email protected]",
"sub": "00000000-0000-1111-a111-000000000019",
},
"new_user": {
"given_name": "New",
"family_name": "User",
"email": "[email protected]",
"sub": "00000000-0000-1111-a111-000000000017",
},
}

def authenticate(self, auth_code):
Expand Down
2 changes: 1 addition & 1 deletion backend/ops_api/tests/auth/test_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_get_roles(auth_client):

assert {"id": 1, "name": "SYSTEM_OWNER"} in response.json
assert {"id": 2, "name": "VIEWER_EDITOR"} in response.json
assert {"id": 3, "name": "division-director"} in response.json
assert {"id": 3, "name": "REVIEWER_APPROVER"} in response.json
assert {"id": 4, "name": "USER_ADMIN"} in response.json
assert {"id": 5, "name": "BUDGET_TEAM"} in response.json

Expand Down
14 changes: 7 additions & 7 deletions backend/ops_api/tests/ops/agreement/test_agreement_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_agreement_history_log_items(auth_client, app, test_can, utc_today):

@pytest.mark.usefixtures("app_ctx")
def test_agreement_history_log_items_with_change_requests(
division_director_auth_client, loaded_db, test_can, test_project, utc_today
budget_team_auth_client, division_director_auth_client, loaded_db, test_can, test_project, utc_today
):
# create agreement (using API)
data = {
Expand All @@ -306,7 +306,7 @@ def test_agreement_history_log_items_with_change_requests(
],
"notes": "New Agreement for purpose X",
}
resp = division_director_auth_client.post("/api/v1/agreements/", json=data)
resp = budget_team_auth_client.post("/api/v1/agreements/", json=data)
assert resp.status_code == 201
assert "id" in resp.json
agreement_id = resp.json["id"]
Expand All @@ -328,15 +328,15 @@ def test_agreement_history_log_items_with_change_requests(

# submit PATCH BLI which triggers a budget change requests
data = {"amount": 333.33, "can_id": 502, "date_needed": "2032-03-03"}
response = division_director_auth_client.patch(url_for("api.budget-line-items-item", id=bli.id), json=data)
response = budget_team_auth_client.patch(url_for("api.budget-line-items-item", id=bli.id), json=data)
assert response.status_code == 202
resp_json = response.json
assert "change_requests_in_review" in resp_json
change_requests_in_review = resp_json["change_requests_in_review"]
assert len(change_requests_in_review) == 3

# verify agreement history added (+3 change requests created)
resp = division_director_auth_client.get(f"/api/v1/agreement-history/{agreement_id}?limit=100")
resp = budget_team_auth_client.get(f"/api/v1/agreement-history/{agreement_id}?limit=100")
assert resp.status_code == 200
hist_json = resp.json
hist_count = len(hist_json)
Expand All @@ -351,7 +351,7 @@ def test_agreement_history_log_items_with_change_requests(
log_item = hist_json[i]["log_items"][0]
assert log_item["event_class_name"] == "BudgetLineItemChangeRequest"
assert log_item["target_class_name"] == "BudgetLineItem"
assert log_item["created_by_user_full_name"] == "Dave Director"
assert log_item["created_by_user_full_name"] == "Budget Team"
assert log_item["event_type"] == "IN_REVIEW"
assert log_item["scope"] == "PROPERTY"
assert log_item["created_on"] is not None
Expand All @@ -372,7 +372,7 @@ def test_agreement_history_log_items_with_change_requests(
assert response.status_code == 200

# verify agreement history added for 3 reviews and 3 approved updates
resp = division_director_auth_client.get(f"/api/v1/agreement-history/{agreement_id}?limit=100")
resp = budget_team_auth_client.get(f"/api/v1/agreement-history/{agreement_id}?limit=100")
assert resp.status_code == 200
hist_json = resp.json
hist_count = len(hist_json)
Expand All @@ -389,7 +389,7 @@ def test_agreement_history_log_items_with_change_requests(
assert log_item["event_type"] == "APPROVED"
assert log_item["target_class_name"] == "BudgetLineItem"
assert log_item["updated_by_change_request"] is False
assert log_item["changes_requested_by_user_full_name"] == "Dave Director"
assert log_item["changes_requested_by_user_full_name"] == "Budget Team"
# log item for the BLI update
elif log_item["event_class_name"] == "BudgetLineItem":
assert log_item["event_type"] == "UPDATED"
Expand Down
10 changes: 5 additions & 5 deletions backend/ops_api/tests/ops/workflows/test_change_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_budget_line_item_change_request(app, test_bli):

@pytest.mark.usefixtures("app_ctx")
def test_budget_line_item_patch_with_budgets_change_requests(
division_director_auth_client, app, loaded_db, test_division_director, test_can
budget_team_auth_client, division_director_auth_client, app, loaded_db, test_division_director, test_can
):
session = app.db_session
agreement_id = 1
Expand Down Expand Up @@ -118,7 +118,7 @@ def test_budget_line_item_patch_with_budgets_change_requests(

# submit PATCH BLI which triggers a budget change requests
data = {"amount": 222.22, "can_id": 501, "date_needed": "2032-02-02"}
response = division_director_auth_client.patch(url_for("api.budget-line-items-item", id=bli_id), json=data)
response = budget_team_auth_client.patch(url_for("api.budget-line-items-item", id=bli_id), json=data)
assert response.status_code == 202
resp_json = response.json
assert "change_requests_in_review" in resp_json
Expand Down Expand Up @@ -325,7 +325,7 @@ def test_change_request_list(auth_client, app, test_user, test_admin_user, test_

@pytest.mark.usefixtures("app_ctx")
def test_budget_line_item_patch_with_status_change_requests(
division_director_auth_client, app, loaded_db, test_division_director
budget_team_auth_client, division_director_auth_client, app, loaded_db, test_division_director
):
session = app.db_session
agreement_id = 1
Expand Down Expand Up @@ -357,7 +357,7 @@ def test_budget_line_item_patch_with_status_change_requests(

# submit PATCH BLI which is rejected due to missing required fields
data = {"status": "PLANNED", "requestor_notes": "Notes from the requestor"}
response = division_director_auth_client.patch(url_for("api.budget-line-items-item", id=bli_id), json=data)
response = budget_team_auth_client.patch(url_for("api.budget-line-items-item", id=bli_id), json=data)
assert response.status_code == 400
assert "_schema" in response.json
assert len(response.json["_schema"]) == 3
Expand All @@ -377,7 +377,7 @@ def test_budget_line_item_patch_with_status_change_requests(
prev_hist_count = hist_count

# submit PATCH BLI which triggers a change request for status change
response = division_director_auth_client.patch(url_for("api.budget-line-items-item", id=bli_id), json=data)
response = budget_team_auth_client.patch(url_for("api.budget-line-items-item", id=bli_id), json=data)

assert response.status_code == 202
resp_json = response.json
Expand Down
Loading

0 comments on commit eaf21ce

Please sign in to comment.