Skip to content

Commit

Permalink
fix: only allow to lapse STARTED applications
Browse files Browse the repository at this point in the history
  • Loading branch information
yolile committed Nov 29, 2024
1 parent f9ea2d9 commit 43c1e85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/routers/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,7 @@ async def lapse_application(
Depends(
dependencies.get_scoped_application_as_user(
roles=(models.UserType.FI,),
statuses=(
models.ApplicationStatus.SUBMITTED,
models.ApplicationStatus.STARTED,
),
statuses=(models.ApplicationStatus.STARTED,),
)
),
],
Expand Down
2 changes: 1 addition & 1 deletion tests/routers/test_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def test_lapse_application(client, session, lender_header, pending_application):
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert response.json() == {"detail": _("Application status should not be %(status)s", status=_("PENDING"))}

pending_application.status = models.ApplicationStatus.SUBMITTED
pending_application.status = models.ApplicationStatus.STARTED
session.commit()

response = client.post(f"/applications/{pending_application.id}/lapse", headers=lender_header)
Expand Down

0 comments on commit 43c1e85

Please sign in to comment.