From 5ea450064c2f00f80d4179330c853d8f26da8417 Mon Sep 17 00:00:00 2001 From: David Fischer Date: Tue, 17 Mar 2015 15:33:25 +0100 Subject: [PATCH] Fix tests under python3 --- tests/client.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/client.py b/tests/client.py index 10e17f9..4b1c7d5 100644 --- a/tests/client.py +++ b/tests/client.py @@ -30,11 +30,9 @@ def test_error_response(self, r_post): reply = {"ok": False, "error": "There was an error"} r_post.return_value.json.return_value = reply - with self.assertRaises(pyslack.SlackError) as context: + with self.assertRaisesRegexp(pyslack.SlackError, reply["error"]): client.chat_post_message('#channel', 'message') - self.assertEqual(context.exception.message, reply["error"]) - @patch('requests.post') def test_rate_limit(self, r_post): """HTTP 429 Too Many Requests response is handled gracefully""" @@ -48,7 +46,7 @@ def test_rate_limit(self, r_post): client.chat_post_message('#channel', 'message') self.assertEqual(r_post.call_count, 1) - self.assertGreater(client.blocked_until, + self.assertGreater(client.blocked_until, datetime.datetime.utcnow() + datetime.timedelta(seconds=8)) # A second send attempt should also throw, but without creating a request