mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
Remove no longer relevant test + linting
This commit is contained in:
parent
ad43fabbab
commit
997fc1bbed
3 changed files with 12 additions and 15 deletions
|
@ -1942,12 +1942,7 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
|
||||
# == Handle action needed and rejected emails == #
|
||||
# Edge case: this logic is handled by javascript, so contexts outside that must be handled
|
||||
if obj.status == DomainRequest.DomainRequestStatus.ACTION_NEEDED:
|
||||
if obj.action_needed_reason and not obj.action_needed_reason_email:
|
||||
obj.action_needed_reason_email = get_action_needed_reason_default_email(obj, obj.action_needed_reason)
|
||||
elif obj.status == DomainRequest.DomainRequestStatus.REJECTED:
|
||||
if obj.rejection_reason and not obj.rejection_reason_email:
|
||||
obj.rejection_reason_email = get_rejection_reason_default_email(obj, obj.rejection_reason)
|
||||
obj = self._handle_custom_emails()
|
||||
|
||||
# == Handle allowed emails == #
|
||||
if obj.status in DomainRequest.get_statuses_that_send_emails() and not settings.IS_PRODUCTION:
|
||||
|
@ -1965,6 +1960,15 @@ class DomainRequestAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
|||
if should_save:
|
||||
return super().save_model(request, obj, form, change)
|
||||
|
||||
def _handle_custom_emails(self, obj):
|
||||
if obj.status == DomainRequest.DomainRequestStatus.ACTION_NEEDED:
|
||||
if obj.action_needed_reason and not obj.action_needed_reason_email:
|
||||
obj.action_needed_reason_email = get_action_needed_reason_default_email(obj, obj.action_needed_reason)
|
||||
elif obj.status == DomainRequest.DomainRequestStatus.REJECTED:
|
||||
if obj.rejection_reason and not obj.rejection_reason_email:
|
||||
obj.rejection_reason_email = get_rejection_reason_default_email(obj, obj.rejection_reason)
|
||||
return obj
|
||||
|
||||
def _check_for_valid_email(self, request, obj):
|
||||
"""Certain emails are whitelisted in non-production environments,
|
||||
so we should display that information using this function.
|
||||
|
|
|
@ -709,8 +709,8 @@ class DomainRequest(TimeStampedModel):
|
|||
bcc_address = settings.DEFAULT_FROM_EMAIL if settings.IS_PRODUCTION else ""
|
||||
self._send_status_update_email(
|
||||
new_status=status,
|
||||
email_template=f"emails/includes/custom_email.txt",
|
||||
email_template_subject=f"emails/status_change_subject.txt",
|
||||
email_template="emails/includes/custom_email.txt",
|
||||
email_template_subject="emails/status_change_subject.txt",
|
||||
bcc_address=bcc_address,
|
||||
custom_email_content=status_info.get("email"),
|
||||
wrap_email=True,
|
||||
|
|
|
@ -355,13 +355,6 @@ class TestDomainRequest(TestCase):
|
|||
domain_request, msg, "withdraw", 1, expected_content="withdrawn", expected_email=user.email
|
||||
)
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_reject_sends_email(self):
|
||||
msg = "Create a domain request and reject it and see if email was sent."
|
||||
user, _ = User.objects.get_or_create(username="testy")
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED, user=user)
|
||||
self.check_email_sent(domain_request, msg, "reject", 1, expected_content="Hi", expected_email=user.email)
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_reject_with_prejudice_does_not_send_email(self):
|
||||
msg = "Create a domain request and reject it with prejudice and see if email was sent."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue