Initialize email tests

This commit is contained in:
Erin Song 2025-01-29 15:10:06 -08:00
parent 691220698d
commit 59bda0b3cc
No known key found for this signature in database
3 changed files with 14 additions and 7 deletions

View file

@ -1518,7 +1518,6 @@ class DomainInvitationAdmin(BaseInvitationAdmin):
# Get the filtered values # Get the filtered values
return super().changelist_view(request, extra_context=extra_context) return super().changelist_view(request, extra_context=extra_context)
def delete_view(self, request, object_id, extra_context=None): def delete_view(self, request, object_id, extra_context=None):
""" """
Custom delete_view to perform additional actions or customize the template. Custom delete_view to perform additional actions or customize the template.

View file

@ -980,6 +980,14 @@ class TestDomainManagers(TestDomainOverview):
success_page = success_result.follow() success_page = success_result.follow()
self.assertContains(success_page, "Failed to send email.") self.assertContains(success_page, "Failed to send email.")
@boto3_mocking.patching
@less_console_noise_decorator
def test_domain_remove_manager(self):
"""Removing a domain manager sends notification email to other domain managers."""
print("self:", self)
response = self.client.get(reverse("domain-user-delete", kwargs={"pk": self.domain.id, "user_pk": self.user.id}))
print("response: ", response)
@less_console_noise_decorator @less_console_noise_decorator
@patch("registrar.views.domain.send_domain_invitation_email") @patch("registrar.views.domain.send_domain_invitation_email")
def test_domain_invitation_created(self, mock_send_domain_email): def test_domain_invitation_created(self, mock_send_domain_email):

View file

@ -1344,7 +1344,7 @@ class DomainDeleteUserView(UserDomainRolePermissionDeleteView):
"removed_by": self.request.user, "removed_by": self.request.user,
"manager_removed": self.object.user, "manager_removed": self.object.user,
"date": date.today(), "date": date.today(),
"changes": "Domain Manager" "changes": "Domain Manager",
} }
self.email_domain_managers( self.email_domain_managers(
domain, domain,
@ -1368,7 +1368,7 @@ class DomainDeleteUserView(UserDomainRolePermissionDeleteView):
send_templated_email( send_templated_email(
template, template,
subject_template, subject_template,
to_address=email, # type: ignore to_address=email,
context=context, context=context,
) )
except EmailSendingError: except EmailSendingError: