File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -171,10 +171,9 @@ def test_rejected_to(self):
171171
172172 @override_settings (MANDRILL_API_KEY = "Hey, that's not an API key!" )
173173 def test_invalid_api_key (self ):
174- # Example of trying to send with an invalid MANDRILL_API_KEY
175- with self .assertRaises (AnymailAPIError ) as cm :
174+ # Example of trying to send with an invalid MANDRILL_API_KEY.
175+ # Mandrill responds either 401 or 500 status for this case (it varies),
176+ # but always seems to include the message "Invalid API key".
177+ # Either response should result in an AnymailAPIError.
178+ with self .assertRaisesMessage (AnymailAPIError , "Invalid API key" ):
176179 self .message .send ()
177- err = cm .exception
178- self .assertEqual (err .status_code , 500 )
179- # Make sure the exception message includes Mandrill's response:
180- self .assertIn ("Invalid API key" , str (err ))
You can’t perform that action at this time.
0 commit comments