Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests under python3 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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