From 42848e0eed8e37dfcfde901deb94d2096a52c916 Mon Sep 17 00:00:00 2001 From: medmunds Date: Fri, 25 Sep 2015 14:48:32 -0700 Subject: [PATCH] Integration tests handle 'queued' response Rapid-fire pelting from our Travis tests sometimes causes the Mandrill API to queue a "send" call, rather than deal with it immediately. If that occurs, we generally have to just ignore that test (in that test run). --- djrill/tests/test_mandrill_integration.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/djrill/tests/test_mandrill_integration.py b/djrill/tests/test_mandrill_integration.py index 99b0235..6dc5d04 100644 --- a/djrill/tests/test_mandrill_integration.py +++ b/djrill/tests/test_mandrill_integration.py @@ -39,7 +39,7 @@ class DjrillIntegrationTests(TestCase): self.assertEqual(sent_count, 1) # noinspection PyUnresolvedReferences response = self.message.mandrill_response - self.assertEqual(response[0]['status'], 'sent') # successful send (could still bounce later) + self.assertIn(response[0]['status'], ['sent', 'queued']) # successful send (could still bounce later) self.assertEqual(response[0]['email'], 'to@example.com') self.assertGreater(len(response[0]['_id']), 0) @@ -61,6 +61,8 @@ class DjrillIntegrationTests(TestCase): self.assertEqual(sent_count, 1) # The send call is "successful"... # noinspection PyUnresolvedReferences response = self.message.mandrill_response + if response[0]['status'] == 'queued': + self.skipTest("Mandrill queued the send -- can't complete this test") self.assertEqual(response[0]['status'], 'invalid') # ... but the mail is not delivered def test_rejected_to(self): @@ -70,6 +72,8 @@ class DjrillIntegrationTests(TestCase): self.assertEqual(sent_count, 1) # The send call is "successful"... # noinspection PyUnresolvedReferences response = self.message.mandrill_response + if response[0]['status'] == 'queued': + self.skipTest("Mandrill queued the send -- can't complete this test") self.assertEqual(response[0]['status'], 'rejected') # ... but the mail is not delivered self.assertEqual(response[0]['reject_reason'], 'test') # ... and here's why