diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-02 09:58:56 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-08 15:11:57 +0200 |
commit | b459586d96ec1f765d7aed86538b8d8576977f6c (patch) | |
tree | 63488459b22c11b83589b9cfe562f58b4c701b57 /_pytest/test_sendmessage.py | |
parent | 82147d2d2a47927528e993816ee9393a4aa15b83 (diff) | |
download | wee-slack-b459586d96ec1f765d7aed86538b8d8576977f6c.tar.gz |
Cleanup tests and make them compatible with python 3
This mainly adds team, channel_general and user_alice as fixtures, so we
can use those directly instead of picking arbitrary ones from the lists.
It also adds assertions to some tests which where missing it.
Diffstat (limited to '_pytest/test_sendmessage.py')
-rw-r--r-- | _pytest/test_sendmessage.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/_pytest/test_sendmessage.py b/_pytest/test_sendmessage.py index 9446e07..17f38d7 100644 --- a/_pytest/test_sendmessage.py +++ b/_pytest/test_sendmessage.py @@ -1,22 +1,18 @@ from __future__ import print_function, unicode_literals -def test_send_message(realish_eventrouter, mock_websocket): - e = realish_eventrouter +import json - t = e.teams.keys()[0] - #u = e.teams[t].users.keys()[0] - #user = e.teams[t].users[u] - #print(user) +def test_send_message(realish_eventrouter, team, channel_general): + message_text = 'send message test' + channel_general.send_message(message_text) - socket = mock_websocket - e.teams[t].ws = socket + sent = json.loads(team.ws.sentdata[0]) - c = e.teams[t].channels.keys()[0] - - channel = e.teams[t].channels[c] - channel.send_message('asdf') - - print(c) - - #assert False + assert sent == { + 'text': message_text, + 'type': 'message', + 'user': team.myidentifier, + 'channel': channel_general.id, + 'id': 1, + } |