Skip to content

Commit

Permalink
Update schema to require budget field on /can-funding-budgets (#3336)
Browse files Browse the repository at this point in the history
* feat: make budget required on post can funding budgets

* chore: remove service handling

* chore: remove unit test
  • Loading branch information
maiyerlee authored Jan 28, 2025
1 parent ddc096b commit e695e0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3048,6 +3048,7 @@ components:
required:
- fiscal_year
- can_id
- budget
FundingBudget:
description: Funding Budget Object
type: object
Expand Down
2 changes: 1 addition & 1 deletion backend/ops_api/ops/schemas/cans.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class FundingBudgetSchema(Schema):
class CreateUpdateFundingBudgetSchema(Schema):
fiscal_year = fields.Integer(required=True)
can_id = fields.Integer(required=True)
budget = fields.Float(load_default=None)
budget = fields.Float(required=True)
notes = fields.String(load_default=None)


Expand Down
9 changes: 9 additions & 0 deletions backend/ops_api/tests/ops/can/test_can_funding_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ def test_service_create_funding_budget(loaded_db):
loaded_db.commit()


def test_funding_budget_post_400_missing_budget(budget_team_auth_client):
response = budget_team_auth_client.post(
"/api/v1/can-funding-budgets/", json={"can_id": 500, "fiscal_year": 2024, "notes": "This is a note"}
)

assert response.status_code == 400
assert response.json["budget"][0] == "Missing data for required field."


# Testing updating CANs by PATCH
@pytest.mark.usefixtures("app_ctx")
def test_funding_budget_patch(budget_team_auth_client, mocker):
Expand Down

0 comments on commit e695e0e

Please sign in to comment.