aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_processteamjoin.py
diff options
context:
space:
mode:
Diffstat (limited to '_pytest/test_processteamjoin.py')
-rw-r--r--_pytest/test_processteamjoin.py30
1 files changed, 10 insertions, 20 deletions
diff --git a/_pytest/test_processteamjoin.py b/_pytest/test_processteamjoin.py
index 64e704a..8e83458 100644
--- a/_pytest/test_processteamjoin.py
+++ b/_pytest/test_processteamjoin.py
@@ -1,28 +1,18 @@
from __future__ import print_function, unicode_literals
-import glob
import json
-def test_process_team_join(mock_websocket, realish_eventrouter):
- eventrouter = realish_eventrouter
+def test_process_team_join(realish_eventrouter, team):
+ # delete charles so we can add him
+ del team.users['U4096CBHC']
- t = eventrouter.teams.keys()[0]
+ assert len(team.users) == 3
- #delete charles so we can add him
- del eventrouter.teams[t].users['U4096CBHC']
+ datafile = '_pytest/data/websocket/1485975606.59-team_join.json'
+ data = json.loads(open(datafile, 'r').read())
+ team.ws.add(data)
+ realish_eventrouter.receive_ws_callback(team.team_hash)
+ realish_eventrouter.handle_next()
- assert len(eventrouter.teams[t].users) == 3
-
- socket = mock_websocket
- eventrouter.teams[t].ws = socket
-
- datafiles = glob.glob("_pytest/data/websocket/1485975606.59-team_join.json")
-
- for fname in datafiles:
- data = json.loads(open(fname, 'r').read())
- socket.add(data)
- eventrouter.receive_ws_callback(t)
- eventrouter.handle_next()
-
- assert len(eventrouter.teams[t].users) == 4
+ assert len(team.users) == 4