linter errors and test cleanup

This commit is contained in:
matthewswspence 2024-10-18 14:14:34 -05:00
parent a722d3c9c5
commit 172c5d31c5
No known key found for this signature in database
GPG key ID: FB458202A7852BA4
5 changed files with 10 additions and 1033 deletions

View file

@ -25,7 +25,7 @@ services:
# Run Django in debug mode on local # Run Django in debug mode on local
- DJANGO_DEBUG=True - DJANGO_DEBUG=True
# Set DJANGO_LOG_LEVEL in env # Set DJANGO_LOG_LEVEL in env
- DJANGO_LOG_LEVEL - DJANGO_LOG_LEVEL=DEBUG
# Run Django without production flags # Run Django without production flags
- IS_PRODUCTION=False - IS_PRODUCTION=False
# Tell Django where it is being hosted # Tell Django where it is being hosted

File diff suppressed because it is too large Load diff

View file

@ -305,7 +305,7 @@ class TestDomainRequest(TestCase):
@less_console_noise_decorator @less_console_noise_decorator
def test_submit_from_withdrawn_sends_email(self): def test_submit_from_withdrawn_sends_email(self):
msg = "Create a withdrawn domain request and submit it and see if email was sent." msg = "Create a withdrawn domain request and submit it and see if email was sent."
user, _ = User.objects.get_or_create(username="testy") user, _ = User.objects.get_or_create(username="testy", email="testy@town.com")
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.WITHDRAWN, user=user) domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.WITHDRAWN, user=user)
self.check_email_sent(domain_request, msg, "submit", 1, expected_content="Hi", expected_email=user.email) self.check_email_sent(domain_request, msg, "submit", 1, expected_content="Hi", expected_email=user.email)
@ -324,14 +324,14 @@ class TestDomainRequest(TestCase):
@less_console_noise_decorator @less_console_noise_decorator
def test_approve_sends_email(self): def test_approve_sends_email(self):
msg = "Create a domain request and approve it and see if email was sent." msg = "Create a domain request and approve it and see if email was sent."
user, _ = User.objects.get_or_create(username="testy") user, _ = User.objects.get_or_create(username="testy", email="testy@town.com")
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW, user=user) domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW, user=user)
self.check_email_sent(domain_request, msg, "approve", 1, expected_content="approved", expected_email=user.email) self.check_email_sent(domain_request, msg, "approve", 1, expected_content="approved", expected_email=user.email)
@less_console_noise_decorator @less_console_noise_decorator
def test_withdraw_sends_email(self): def test_withdraw_sends_email(self):
msg = "Create a domain request and withdraw it and see if email was sent." msg = "Create a domain request and withdraw it and see if email was sent."
user, _ = User.objects.get_or_create(username="testy") user, _ = User.objects.get_or_create(username="testy", email="testy@town.com")
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW, user=user) domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW, user=user)
self.check_email_sent( self.check_email_sent(
domain_request, msg, "withdraw", 1, expected_content="withdrawn", expected_email=user.email domain_request, msg, "withdraw", 1, expected_content="withdrawn", expected_email=user.email
@ -339,7 +339,7 @@ class TestDomainRequest(TestCase):
def test_reject_sends_email(self): def test_reject_sends_email(self):
"Create a domain request and reject it and see if email was sent." "Create a domain request and reject it and see if email was sent."
user, _ = User.objects.get_or_create(username="testy") user, _ = User.objects.get_or_create(username="testy", email="testy@town.com")
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED, user=user) domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED, user=user)
expected_email = user.email expected_email = user.email
email_allowed, _ = AllowedEmail.objects.get_or_create(email=expected_email) email_allowed, _ = AllowedEmail.objects.get_or_create(email=expected_email)

View file

@ -2099,7 +2099,6 @@ class TestDomainChangeNotifications(TestDomainOverview):
# Check that an email was not sent # Check that an email was not sent
self.assertFalse(self.mock_client.send_email.called) self.assertFalse(self.mock_client.send_email.called)
@boto3_mocking.patching @boto3_mocking.patching
@less_console_noise_decorator @less_console_noise_decorator
def test_notification_on_security_email_change(self): def test_notification_on_security_email_change(self):
@ -2154,7 +2153,7 @@ class TestDomainChangeNotifications(TestDomainOverview):
self.assertIn("DOMAIN: igorville.gov", body) self.assertIn("DOMAIN: igorville.gov", body)
self.assertIn("UPDATED BY: First Last info@example.com", body) self.assertIn("UPDATED BY: First Last info@example.com", body)
self.assertIn("INFORMATION UPDATED: DNSSec", body) self.assertIn("INFORMATION UPDATED: DNSSEC / DS Data", body)
@boto3_mocking.patching @boto3_mocking.patching
@less_console_noise_decorator @less_console_noise_decorator

View file

@ -173,9 +173,9 @@ class DomainFormBaseView(DomainBaseView, FormMixin):
SeniorOfficialContactForm, SeniorOfficialContactForm,
} }
is_analyst_action = ("analyst_action" in self.session and "analyst_action_location" in self.session) is_analyst_action = "analyst_action" in self.session and "analyst_action_location" in self.session
should_notify=False should_notify = False
if form.__class__ in form_label_dict: if form.__class__ in form_label_dict:
if is_analyst_action: if is_analyst_action:
@ -206,9 +206,7 @@ class DomainFormBaseView(DomainBaseView, FormMixin):
context, context,
) )
else: else:
logger.info( logger.info(f"No notification sent for {form.__class__}.")
f"No notification sent for {form.__class__}. form changes: {form.has_changed()}, force_send: {force_send}"
)
def email_domain_managers(self, domain: Domain, template: str, subject_template: str, context={}): def email_domain_managers(self, domain: Domain, template: str, subject_template: str, context={}):
"""Send a single email built from a template to all managers for a given domain. """Send a single email built from a template to all managers for a given domain.