mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-14 16:47:02 +02:00
Merge pull request #1899 from cisagov/za/1864-error-message-rejection-placement
(on getgov-za) Ticket #1864: Move error message for rejection reason required
This commit is contained in:
commit
35ffdc7bd0
6 changed files with 60 additions and 10 deletions
|
@ -555,6 +555,24 @@ class TestDomainRequestAdminForm(TestCase):
|
|||
expected_choices = [("started", "Started"), ("submitted", "Submitted")]
|
||||
self.assertEqual(form.fields["status"].widget.choices, expected_choices)
|
||||
|
||||
def test_form_no_rejection_reason(self):
|
||||
with less_console_noise():
|
||||
# Create a form instance with the test domain request
|
||||
form = DomainRequestAdminForm(instance=self.domain_request)
|
||||
|
||||
form = DomainRequestAdminForm(
|
||||
instance=self.domain_request,
|
||||
data={
|
||||
"status": DomainRequest.DomainRequestStatus.REJECTED,
|
||||
"rejection_reason": None,
|
||||
},
|
||||
)
|
||||
self.assertFalse(form.is_valid())
|
||||
self.assertIn("rejection_reason", form.errors)
|
||||
|
||||
rejection_reason = form.errors.get("rejection_reason")
|
||||
self.assertEqual(rejection_reason, ["A rejection reason is required."])
|
||||
|
||||
def test_form_choices_when_no_instance(self):
|
||||
with less_console_noise():
|
||||
# Create a form instance without an instance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue