Skip to content

Commit

Permalink
Tests: update Postmark integration
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
medmunds committed Jun 27, 2023
1 parent 4f4461a commit bc8ef9a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/test_postmark_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ def test_template(self):

@override_settings(ANYMAIL_POSTMARK_SERVER_TOKEN="Hey, that's not a server token!")
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()
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))

0 comments on commit bc8ef9a

Please sign in to comment.