add decorator

This commit is contained in:
zandercymatics 2024-07-16 12:44:04 -06:00
parent 35c8a57aa3
commit f0f8bbf26a
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -2288,72 +2288,71 @@ class TestDomainRequestAdmin(MockEppLib):
self.assertContains(response, "When a domain request is in ineligible status") self.assertContains(response, "When a domain request is in ineligible status")
self.assertContains(response, "Yes, select ineligible status") self.assertContains(response, "Yes, select ineligible status")
@less_console_noise_decorator
def test_readonly_when_restricted_creator(self): def test_readonly_when_restricted_creator(self):
self.maxDiff = None domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
with less_console_noise(): with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) domain_request.creator.status = User.RESTRICTED
with boto3_mocking.clients.handler_for("sesv2", self.mock_client): domain_request.creator.save()
domain_request.creator.status = User.RESTRICTED
domain_request.creator.save()
request = self.factory.get("/") request = self.factory.get("/")
request.user = self.superuser request.user = self.superuser
readonly_fields = self.admin.get_readonly_fields(request, domain_request) readonly_fields = self.admin.get_readonly_fields(request, domain_request)
expected_fields = [ expected_fields = [
"other_contacts", "other_contacts",
"current_websites", "current_websites",
"alternative_domains", "alternative_domains",
"is_election_board", "is_election_board",
"federal_agency", "federal_agency",
"status_history", "status_history",
"id", "id",
"created_at", "created_at",
"updated_at", "updated_at",
"status", "status",
"rejection_reason", "rejection_reason",
"action_needed_reason", "action_needed_reason",
"action_needed_reason_email", "action_needed_reason_email",
"federal_agency", "federal_agency",
"portfolio", "portfolio",
"sub_organization", "sub_organization",
"creator", "creator",
"investigator", "investigator",
"generic_org_type", "generic_org_type",
"is_election_board", "is_election_board",
"organization_type", "organization_type",
"federally_recognized_tribe", "federally_recognized_tribe",
"state_recognized_tribe", "state_recognized_tribe",
"tribe_name", "tribe_name",
"federal_type", "federal_type",
"organization_name", "organization_name",
"address_line1", "address_line1",
"address_line2", "address_line2",
"city", "city",
"state_territory", "state_territory",
"zipcode", "zipcode",
"urbanization", "urbanization",
"about_your_organization", "about_your_organization",
"senior_official", "senior_official",
"approved_domain", "approved_domain",
"requested_domain", "requested_domain",
"submitter", "submitter",
"purpose", "purpose",
"no_other_contacts_rationale", "no_other_contacts_rationale",
"anything_else", "anything_else",
"has_anything_else_text", "has_anything_else_text",
"cisa_representative_email", "cisa_representative_email",
"cisa_representative_first_name", "cisa_representative_first_name",
"cisa_representative_last_name", "cisa_representative_last_name",
"has_cisa_representative", "has_cisa_representative",
"is_policy_acknowledged", "is_policy_acknowledged",
"submission_date", "submission_date",
"notes", "notes",
"alternative_domains", "alternative_domains",
] ]
self.assertEqual(readonly_fields, expected_fields) self.assertEqual(readonly_fields, expected_fields)
def test_readonly_fields_for_analyst(self): def test_readonly_fields_for_analyst(self):
with less_console_noise(): with less_console_noise():