Skip to content

Commit

Permalink
Changed obligate_by to an integer to fix serialization issues. Update…
Browse files Browse the repository at this point in the history
…d test_service_patch_can to not rely on hard-coded id for table item.
  • Loading branch information
rajohnson90 committed Sep 19, 2024
1 parent 64c2f70 commit ce39390
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 1 addition & 2 deletions backend/ops_api/ops/schemas/cans.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class CreateCANRequestSchema(Schema):
number = fields.String(required=True)
description = fields.String(allow_none=True)
portfolio_id = fields.Integer(required=True)
obligate_by = fields.DateTime(format="%Y-%m-%dT", allow_none=True)


class BasicCANSchema(Schema):
Expand All @@ -22,7 +21,7 @@ class BasicCANSchema(Schema):
description = fields.String(allow_none=True)
id = fields.Integer(required=True)
portfolio_id = fields.Integer(required=True)
obligate_by = fields.DateTime(format="%Y-%m-%dT", allow_none=True)
obligate_by = fields.Integer(allow_none=True)
projects = fields.List(fields.Nested(ProjectSchema()), default=[])


Expand Down
6 changes: 1 addition & 5 deletions backend/ops_api/tests/ops/can/test_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,7 @@ def test_basic_user_cannot_patch_cans(basic_user_auth_client):


def test_service_patch_can(loaded_db):
test_can_id = 517
update_data = {
"id": test_can_id,
"portfolio_id": 6,
"number": "G998235",
"description": "Test Test Test",
}

Expand All @@ -251,7 +247,7 @@ def test_service_patch_can(loaded_db):

can_service = CANService()

updated_can = can_service.update_by_fields(update_data, test_can_id)
updated_can = can_service.update_by_fields(update_data, new_can.id)

can = loaded_db.execute(select(CAN).where(CAN.number == "G998235")).scalar_one()

Expand Down

0 comments on commit ce39390

Please sign in to comment.