Merge branch 'main' into za/1848-copy-contact-email-to-clipboard

This commit is contained in:
zandercymatics 2024-03-28 10:23:10 -06:00
commit b6a8024732
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
49 changed files with 791 additions and 226 deletions

View file

@ -285,9 +285,9 @@ class TestDomainAdmin(MockEppLib, WebTest):
# There are 4 template references to Federal (4) plus four references in the table
# for our actual domain_request
self.assertContains(response, "Federal", count=8)
self.assertContains(response, "Federal", count=36)
# This may be a bit more robust
self.assertContains(response, '<td class="field-organization_type">Federal</td>', count=1)
self.assertContains(response, '<td class="field-generic_org_type">Federal</td>', count=1)
# Now let's make sure the long description does not exist
self.assertNotContains(response, "Federal: an agency of the U.S. government")
@ -556,6 +556,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
@ -691,9 +709,9 @@ class TestDomainRequestAdmin(MockEppLib):
response = self.client.get("/admin/registrar/domainrequest/")
# There are 4 template references to Federal (4) plus two references in the table
# for our actual domain request
self.assertContains(response, "Federal", count=6)
self.assertContains(response, "Federal", count=34)
# This may be a bit more robust
self.assertContains(response, '<td class="field-organization_type">Federal</td>', count=1)
self.assertContains(response, '<td class="field-generic_org_type">Federal</td>', count=1)
# Now let's make sure the long description does not exist
self.assertNotContains(response, "Federal: an agency of the U.S. government")
@ -1454,7 +1472,7 @@ class TestDomainRequestAdmin(MockEppLib):
"rejection_reason",
"creator",
"investigator",
"organization_type",
"generic_org_type",
"federally_recognized_tribe",
"state_recognized_tribe",
"tribe_name",
@ -1664,7 +1682,7 @@ class TestDomainRequestAdmin(MockEppLib):
readonly_fields = self.admin.get_list_filter(request)
expected_fields = (
"status",
"organization_type",
"generic_org_type",
"federal_type",
DomainRequestAdmin.ElectionOfficeFilter,
"rejection_reason",