Skip to content

Commit

Permalink
Fix tests under python3
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfischer-ch committed Mar 17, 2015
1 parent 8a6397b commit f9ce5d6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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
Expand Down

0 comments on commit f9ce5d6

Please sign in to comment.