This commit is contained in:
zandercymatics 2024-10-01 10:28:40 -06:00
parent 0a7d4e460d
commit 06e4daef6a
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 20 additions and 13 deletions

View file

@ -689,7 +689,7 @@ class DomainRequest(TimeStampedModel):
"reason": self.rejection_reason,
"email": self.rejection_reason_email,
"excluded_reasons": [DomainRequest.RejectionReasons.OTHER],
}
},
}
status_info = status_information.get(status)

View file

@ -600,7 +600,8 @@ class TestDomainRequestAdmin(MockEppLib):
status,
rejection_reason=None,
rejection_reason_email=None,
action_needed_reason=None, action_needed_reason_email=None
action_needed_reason=None,
action_needed_reason_email=None,
):
"""Helper method for the email test cases."""
@ -1073,7 +1074,9 @@ class TestDomainRequestAdmin(MockEppLib):
# Reject for reason REQUESTOR and test email including dynamic organization name
self.transition_state_and_send_email(
domain_request, DomainRequest.DomainRequestStatus.REJECTED, DomainRequest.RejectionReasons.REQUESTOR_NOT_ELIGIBLE
domain_request,
DomainRequest.DomainRequestStatus.REJECTED,
DomainRequest.RejectionReasons.REQUESTOR_NOT_ELIGIBLE,
)
self.assert_email_is_accurate(
"Your domain request was rejected because we dont believe youre eligible to request a \n.gov "

View file

@ -46,6 +46,7 @@ from api.tests.common import less_console_noise_decorator
logger = logging.getLogger(__name__)
@boto3_mocking.patching
class TestDomainRequest(TestCase):
@less_console_noise_decorator
@ -293,6 +294,8 @@ class TestDomainRequest(TestCase):
# Perform the specified action
action_method = getattr(domain_request, action)
action_method()
domain_request.save()
domain_request.refresh_from_db()
# Check if an email was sent
sent_emails = [

View file

@ -8,7 +8,7 @@ def get_action_needed_reason_default_email(domain_request, action_needed_reason)
domain_request,
file_path=f"emails/action_needed_reasons/{action_needed_reason}.txt",
reason=action_needed_reason,
excluded_reasons=[DomainRequest.ActionNeededReasons.OTHER]
excluded_reasons=[DomainRequest.ActionNeededReasons.OTHER],
)
@ -21,6 +21,7 @@ def get_rejection_reason_default_email(domain_request, rejection_reason):
# excluded_reasons=[DomainRequest.RejectionReasons.OTHER]
)
def _get_default_email(domain_request, file_path, reason, excluded_reasons=None):
if not reason:
return None