Skip to content

Commit

Permalink
Fix remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zandercymatics committed Oct 2, 2024
1 parent 2766202 commit 1424197
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/registrar/tests/test_admin_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,7 @@ def test_readonly_when_restricted_creator(self):
"updated_at",
"status",
"rejection_reason",
"rejection_reason_email",
"action_needed_reason",
"action_needed_reason_email",
"federal_agency",
Expand Down
28 changes: 14 additions & 14 deletions src/registrar/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def test_get_action_needed_email_for_user_json_superuser(self):
)
self.assertEqual(response.status_code, 200)
data = response.json()
self.assertIn("action_needed_email", data)
self.assertIn("ORGANIZATION MAY NOT MEET ELIGIBILITY REQUIREMENTS", data["action_needed_email"])
self.assertIn("email", data)
self.assertIn("ORGANIZATION MAY NOT MEET ELIGIBILITY REQUIREMENTS", data["email"])

@less_console_noise_decorator
def test_get_action_needed_email_for_user_json_analyst(self):
Expand All @@ -161,8 +161,8 @@ def test_get_action_needed_email_for_user_json_analyst(self):
)
self.assertEqual(response.status_code, 200)
data = response.json()
self.assertIn("action_needed_email", data)
self.assertIn("SENIOR OFFICIAL DOES NOT MEET ELIGIBILITY REQUIREMENTS", data["action_needed_email"])
self.assertIn("email", data)
self.assertIn("SENIOR OFFICIAL DOES NOT MEET ELIGIBILITY REQUIREMENTS", data["email"])

@less_console_noise_decorator
def test_get_action_needed_email_for_user_json_regular(self):
Expand All @@ -188,32 +188,32 @@ def setUp(self):
self.domain_request = completed_domain_request(
federal_agency=self.agency,
name="test.gov",
status=DomainRequest.DomainRequestStatus.ACTION_NEEDED,
status=DomainRequest.DomainRequestStatus.REJECTED,
)

self.api_url = reverse("get-action-needed-email-for-user-json")
self.api_url = reverse("get-rejection-email-for-user-json")

def tearDown(self):
DomainRequest.objects.all().delete()
User.objects.all().delete()
FederalAgency.objects.all().delete()

@less_console_noise_decorator
def test_get_action_needed_email_for_user_json_superuser(self):
def test_get_rejected_email_for_user_json_superuser(self):
"""Test that a superuser can fetch the action needed email."""
self.client.force_login(self.superuser)

response = self.client.get(
self.api_url,
{
"reason": DomainRequest.ActionNeededReasons.ELIGIBILITY_UNCLEAR,
"reason": DomainRequest.RejectionReasons.CONTACTS_NOT_VERIFIED,
"domain_request_id": self.domain_request.id,
},
)
self.assertEqual(response.status_code, 200)
data = response.json()
self.assertIn("action_needed_email", data)
self.assertIn("ORGANIZATION MAY NOT MEET ELIGIBILITY REQUIREMENTS", data["action_needed_email"])
self.assertIn("email", data)
self.assertIn("we could not verify the organizational", data["email"])

@less_console_noise_decorator
def test_get_action_needed_email_for_user_json_analyst(self):
Expand All @@ -223,14 +223,14 @@ def test_get_action_needed_email_for_user_json_analyst(self):
response = self.client.get(
self.api_url,
{
"reason": DomainRequest.ActionNeededReasons.QUESTIONABLE_SENIOR_OFFICIAL,
"reason": DomainRequest.RejectionReasons.CONTACTS_NOT_VERIFIED,
"domain_request_id": self.domain_request.id,
},
)
self.assertEqual(response.status_code, 200)
data = response.json()
self.assertIn("action_needed_email", data)
self.assertIn("SENIOR OFFICIAL DOES NOT MEET ELIGIBILITY REQUIREMENTS", data["action_needed_email"])
self.assertIn("email", data)
self.assertIn("we could not verify the organizational", data["email"])

@less_console_noise_decorator
def test_get_action_needed_email_for_user_json_regular(self):
Expand All @@ -240,7 +240,7 @@ def test_get_action_needed_email_for_user_json_regular(self):
response = self.client.get(
self.api_url,
{
"reason": DomainRequest.ActionNeededReasons.QUESTIONABLE_SENIOR_OFFICIAL,
"reason": DomainRequest.RejectionReasons.CONTACTS_NOT_VERIFIED,
"domain_request_id": self.domain_request.id,
},
)
Expand Down

0 comments on commit 1424197

Please sign in to comment.