From 4f4461af4d2a0bcb3301b80fd35f1f64de6eef4e Mon Sep 17 00:00:00 2001 From: Mike Edmunds Date: Tue, 27 Jun 2023 12:23:35 -0700 Subject: [PATCH] Tests: update Mandrill integration Mandrill has changed status code for invalid from_email from 500 to 400. (We don't actually care about the specific code, just that the error is caught and reported.) --- tests/test_mandrill_integration.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/test_mandrill_integration.py b/tests/test_mandrill_integration.py index 5dac6c4..a10a2d3 100644 --- a/tests/test_mandrill_integration.py +++ b/tests/test_mandrill_integration.py @@ -108,15 +108,11 @@ class MandrillBackendIntegrationTests(AnymailTestMixin, SimpleTestCase): def test_invalid_from(self): # Example of trying to send from an invalid address - # Mandrill returns a 500 response (which raises a MandrillAPIError) self.message.from_email = ( "webmaster@localhost" # Django default DEFAULT_FROM_EMAIL ) - with self.assertRaises(AnymailAPIError) as cm: + with self.assertRaisesMessage(AnymailAPIError, "email address is invalid"): self.message.send() - err = cm.exception - self.assertEqual(err.status_code, 500) - self.assertIn("email address is invalid", str(err)) def test_invalid_to(self): # Example of detecting when a recipient is not a valid email address