mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-18 02:19:23 +02:00
Fix bcc
This commit is contained in:
parent
1e720b7398
commit
6113176d55
2 changed files with 12 additions and 5 deletions
|
@ -805,6 +805,10 @@ class DomainRequest(TimeStampedModel):
|
||||||
email_template_name = f"{self.action_needed_reason}.txt"
|
email_template_name = f"{self.action_needed_reason}.txt"
|
||||||
email_template_subject_name = f"{self.action_needed_reason}_subject.txt"
|
email_template_subject_name = f"{self.action_needed_reason}_subject.txt"
|
||||||
|
|
||||||
|
bcc_address = ""
|
||||||
|
if settings.IS_PRODUCTION:
|
||||||
|
bcc_address = settings.DEFAULT_FROM_EMAIL
|
||||||
|
|
||||||
# If we can, try to send out an email as long as send_email=True
|
# If we can, try to send out an email as long as send_email=True
|
||||||
if can_send_email:
|
if can_send_email:
|
||||||
self._send_status_update_email(
|
self._send_status_update_email(
|
||||||
|
@ -812,7 +816,7 @@ class DomainRequest(TimeStampedModel):
|
||||||
email_template=f"emails/action_needed_reasons/{email_template_name}",
|
email_template=f"emails/action_needed_reasons/{email_template_name}",
|
||||||
email_template_subject=f"emails/action_needed_reasons/{email_template_subject_name}",
|
email_template_subject=f"emails/action_needed_reasons/{email_template_subject_name}",
|
||||||
send_email=send_email,
|
send_email=send_email,
|
||||||
bcc_address="help@get.gov",
|
bcc_address=bcc_address,
|
||||||
wrap_email=True,
|
wrap_email=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1500,6 +1500,9 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
|
|
||||||
def test_action_needed_sends_reason_email(self):
|
def test_action_needed_sends_reason_email(self):
|
||||||
"""When an action needed reason is set, an email is sent out."""
|
"""When an action needed reason is set, an email is sent out."""
|
||||||
|
# TODO CHANGE BEFORE MERGING
|
||||||
|
settings.DEFAULT_FROM_EMAIL
|
||||||
|
BCC_EMAIL = "fake"
|
||||||
# Ensure there is no user with this email
|
# Ensure there is no user with this email
|
||||||
EMAIL = "mayor@igorville.gov"
|
EMAIL = "mayor@igorville.gov"
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
@ -1512,25 +1515,25 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
# Test the email sent out for already_has_domains
|
# Test the email sent out for already_has_domains
|
||||||
already_has_domains = DomainRequest.ActionNeededReasons.ALREADY_HAS_DOMAINS
|
already_has_domains = DomainRequest.ActionNeededReasons.ALREADY_HAS_DOMAINS
|
||||||
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=already_has_domains)
|
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=already_has_domains)
|
||||||
self.assert_email_is_accurate("ORGANIZATION ALREADY HAS A .GOV DOMAIN", 0, EMAIL, True)
|
self.assert_email_is_accurate("ORGANIZATION ALREADY HAS A .GOV DOMAIN", 0, EMAIL, bcc_email_address="help@get.gov")
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Test the email sent out for bad_name
|
# Test the email sent out for bad_name
|
||||||
bad_name = DomainRequest.ActionNeededReasons.BAD_NAME
|
bad_name = DomainRequest.ActionNeededReasons.BAD_NAME
|
||||||
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=bad_name)
|
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=bad_name)
|
||||||
self.assert_email_is_accurate("DOMAIN NAME DOES NOT MEET .GOV REQUIREMENTS", 1, EMAIL, True)
|
self.assert_email_is_accurate("DOMAIN NAME DOES NOT MEET .GOV REQUIREMENTS", 1, EMAIL, bcc_email_address="help@get.gov")
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
# Test the email sent out for eligibility_unclear
|
# Test the email sent out for eligibility_unclear
|
||||||
eligibility_unclear = DomainRequest.ActionNeededReasons.ELIGIBILITY_UNCLEAR
|
eligibility_unclear = DomainRequest.ActionNeededReasons.ELIGIBILITY_UNCLEAR
|
||||||
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=eligibility_unclear)
|
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=eligibility_unclear)
|
||||||
self.assert_email_is_accurate("ORGANIZATION MAY NOT MEET ELIGIBILITY REQUIREMENTS", 2, EMAIL, True)
|
self.assert_email_is_accurate("ORGANIZATION MAY NOT MEET ELIGIBILITY REQUIREMENTS", 2, EMAIL, bcc_email_address="help@get.gov")
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Test the email sent out for questionable_ao
|
# Test the email sent out for questionable_ao
|
||||||
questionable_ao = DomainRequest.ActionNeededReasons.QUESTIONABLE_AUTHORIZING_OFFICIAL
|
questionable_ao = DomainRequest.ActionNeededReasons.QUESTIONABLE_AUTHORIZING_OFFICIAL
|
||||||
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=questionable_ao)
|
self.transition_state_and_send_email(domain_request, action_needed, action_needed_reason=questionable_ao)
|
||||||
self.assert_email_is_accurate("AUTHORIZING OFFICIAL DOES NOT MEET ELIGIBILITY REQUIREMENTS", 3, EMAIL, True)
|
self.assert_email_is_accurate("AUTHORIZING OFFICIAL DOES NOT MEET ELIGIBILITY REQUIREMENTS", 3, EMAIL, bcc_email_address="help@get.gov")
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 4)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 4)
|
||||||
|
|
||||||
# Assert that no other emails are sent on OTHER
|
# Assert that no other emails are sent on OTHER
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue