Skip to content

Commit

Permalink
fix: remove employee consent attachment limit to 1 (#3221)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast authored Aug 22, 2024
1 parent 2512a8b commit 94ba9e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1211,12 +1211,6 @@ def _validate_employee_consent(self, instance):
raise serializers.ValidationError(
_("Application does not have the employee consent attachment")
)
if consent_count > 1:
raise serializers.ValidationError(
_(
"Application cannot have more than one employee consent attachment"
)
)

def _update_applicant_terms_approval(self, instance, approve_terms):
if ApplicantTermsApproval.terms_approval_needed(instance):
Expand Down
14 changes: 5 additions & 9 deletions backend/benefit/applications/tests/test_applications_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,7 @@ def test_employee_consent_upload(request, api_client, application, settings):
application.pay_subsidy_percent = 50
application.apprenticeship_program = False
application.save()

# add the required attachments except consent
response = _upload_pdf(
request,
Expand All @@ -2096,7 +2097,7 @@ def test_employee_consent_upload(request, api_client, application, settings):
== "Application does not have the employee consent attachment"
)

# upload the consent
# upload the consent two times
_upload_pdf(
request,
api_client,
Expand All @@ -2115,24 +2116,19 @@ def test_employee_consent_upload(request, api_client, application, settings):
).count()
== 2
)
# Cannot upload multiple employee consent
response = _submit_application(api_client, application)
assert response.status_code == 400
assert (
str(response.data[0])
== "Application cannot have more than one employee consent attachment"
)
assert response.status_code == 200

application.attachments.filter(attachment_type=AttachmentType.EMPLOYEE_CONSENT)[
0
].delete()

assert (
application.attachments.filter(
attachment_type=AttachmentType.EMPLOYEE_CONSENT
).count()
== 1
)
response = _submit_application(api_client, application)
assert response.status_code == 200
application.refresh_from_db()
assert application.status == ApplicationStatus.RECEIVED

Expand Down

0 comments on commit 94ba9e9

Please sign in to comment.