Skip to content

Commit bc8ef9a

Browse files
committed
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.)
1 parent 4f4461a commit bc8ef9a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/test_postmark_integration.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ def test_template(self):
132132

133133
@override_settings(ANYMAIL_POSTMARK_SERVER_TOKEN="Hey, that's not a server token!")
134134
def test_invalid_server_token(self):
135-
with self.assertRaises(AnymailAPIError) as cm:
135+
# Message will include something like
136+
# "Request does not contain a valid Server token"
137+
# or "Please verify that you are using a valid token"
138+
with self.assertRaisesRegex(AnymailAPIError, r"valid.*token"):
136139
self.message.send()
137-
err = cm.exception
138-
self.assertEqual(err.status_code, 401)
139-
# Make sure the exception message includes Postmark's response:
140-
self.assertIn("Please verify that you are using a valid token", str(err))

0 commit comments

Comments
 (0)