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_presencechange.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_presencechange.py')
-rw-r--r-- | _pytest/test_presencechange.py | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/_pytest/test_presencechange.py b/_pytest/test_presencechange.py index 71a992b..3dee5c3 100644 --- a/_pytest/test_presencechange.py +++ b/_pytest/test_presencechange.py @@ -1,32 +1,22 @@ from __future__ import print_function, unicode_literals -def test_PresenceChange(realish_eventrouter, mock_websocket): - e = realish_eventrouter - - t = e.teams.keys()[0] - u = e.teams[t].users.keys()[0] - - user = e.teams[t].users[u] - - socket = mock_websocket - e.teams[t].ws = socket - - socket.add({ +def test_PresenceChange(realish_eventrouter, team, user_alice): + team.ws.add({ "type": "presence_change", - "user": user.identifier, + "user": user_alice.identifier, "presence": "active", }) - socket.add({ + team.ws.add({ "type": "presence_change", - "user": user.identifier, + "user": user_alice.identifier, "presence": "away", }) - e.receive_ws_callback(t) - e.handle_next() - assert e.teams[t].users[u].presence == "active" + realish_eventrouter.receive_ws_callback(team.team_hash) + realish_eventrouter.handle_next() + assert user_alice.presence == "active" - e.receive_ws_callback(t) - e.handle_next() - assert e.teams[t].users[u].presence == "away" + realish_eventrouter.receive_ws_callback(team.team_hash) + realish_eventrouter.handle_next() + assert user_alice.presence == "away" |