mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Tests: update Postmark integration
Postmark has changed their error message for invalid server token. (Also, we don't care about the specific error code, just that the error is caught and reported.)
This commit is contained in:
@@ -132,9 +132,8 @@ class PostmarkBackendIntegrationTests(AnymailTestMixin, SimpleTestCase):
|
|||||||
|
|
||||||
@override_settings(ANYMAIL_POSTMARK_SERVER_TOKEN="Hey, that's not a server token!")
|
@override_settings(ANYMAIL_POSTMARK_SERVER_TOKEN="Hey, that's not a server token!")
|
||||||
def test_invalid_server_token(self):
|
def test_invalid_server_token(self):
|
||||||
with self.assertRaises(AnymailAPIError) as cm:
|
# Message will include something like
|
||||||
|
# "Request does not contain a valid Server token"
|
||||||
|
# or "Please verify that you are using a valid token"
|
||||||
|
with self.assertRaisesRegex(AnymailAPIError, r"valid.*token"):
|
||||||
self.message.send()
|
self.message.send()
|
||||||
err = cm.exception
|
|
||||||
self.assertEqual(err.status_code, 401)
|
|
||||||
# Make sure the exception message includes Postmark's response:
|
|
||||||
self.assertIn("Please verify that you are using a valid token", str(err))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user