mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-14 15:05:14 +02:00
Unit test
This commit is contained in:
parent
d0b252b354
commit
425c67fc27
1 changed files with 18 additions and 0 deletions
|
@ -453,6 +453,24 @@ class TestDomainRequestAdminForm(TestCase):
|
||||||
expected_choices = [("started", "Started"), ("submitted", "Submitted")]
|
expected_choices = [("started", "Started"), ("submitted", "Submitted")]
|
||||||
self.assertEqual(form.fields["status"].widget.choices, expected_choices)
|
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):
|
def test_form_choices_when_no_instance(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a form instance without an instance
|
# Create a form instance without an instance
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue