Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1020 from yverdon/feature/yc-1146-test
Browse files Browse the repository at this point in the history
YC-1146: Add UI test when validation by validators is disabled
  • Loading branch information
AlexandreJunod authored Jun 13, 2024
2 parents 94f5d08 + 9bcb395 commit a37cb02
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions geocity/tests/submissions/functional/test_submission_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,76 @@ def test_secretariat_cannot_request_validation_for_already_validated_submission(

self.assertEqual(response.status_code, 400)

def test_secretariat_see_validation_tab_for_submitted_submission(
self,
):
validator_group = factories.ValidatorGroupFactory(
department__administrative_entity=self.administrative_entity
)
submission = factories.SubmissionFactory(
author=self.user,
administrative_entity=self.administrative_entity,
)
form = factories.FormWithoutGeometryFactory(
needs_date=False,
)
submission.forms.set([form])
self.client.post(
reverse(
"submissions:submission_submit",
kwargs={"submission_id": submission.pk},
),
data={
"departments": [validator_group.permit_department.pk],
},
)
submission.refresh_from_db()

response = self.client.get(
reverse(
"submissions:submission_detail",
kwargs={"submission_id": submission.pk},
)
)
self.assertEqual(response.status_code, 200)
parser = get_parser(response.content)
self.assertEqual(len(parser.select("#request-validation")), 1)

def test_secretariat_cannot_see_validation_tab_for_submitted_submission_when_validation_is_disabled(
self,
):
validator_group = factories.ValidatorGroupFactory(
department__administrative_entity=self.administrative_entity
)
submission = factories.SubmissionFactory(
author=self.user,
administrative_entity=self.administrative_entity,
)
form = factories.FormWithoutGeometryFactory(
needs_date=False, disable_validation_by_validators=True
)
submission.forms.set([form])
self.client.post(
reverse(
"submissions:submission_submit",
kwargs={"submission_id": submission.pk},
),
data={
"departments": [validator_group.permit_department.pk],
},
)
submission.refresh_from_db()

response = self.client.get(
reverse(
"submissions:submission_detail",
kwargs={"submission_id": submission.pk},
)
)
self.assertEqual(response.status_code, 200)
parser = get_parser(response.content)
self.assertEqual(len(parser.select("#request-validation")), 0)

def test_default_departments_are_checked(self):
default_validator_groups = factories.ValidatorGroupFactory.create_batch(
2,
Expand Down

0 comments on commit a37cb02

Please sign in to comment.