aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_processteamjoin.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-04-12 22:28:27 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-04-12 22:32:17 +0200
commit8c0203ebdc0674e924f711e92c0056244a866f6d (patch)
treecbac1595e9998eff1f002d07372f272cb76c60aa /_pytest/test_processteamjoin.py
parent01beb42fec5c6dbfc0d8c53ce1de88b48b48f6db (diff)
parent82f6df320adc0d2b3d6c4d6cd1e949ad427ed29f (diff)
downloadwee-slack-8c0203ebdc0674e924f711e92c0056244a866f6d.tar.gz
Merge remote-tracking branch 'wee-ng/master' into wee-ng-merge
Diffstat (limited to '_pytest/test_processteamjoin.py')
-rw-r--r--_pytest/test_processteamjoin.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/_pytest/test_processteamjoin.py b/_pytest/test_processteamjoin.py
new file mode 100644
index 0000000..00a8b4c
--- /dev/null
+++ b/_pytest/test_processteamjoin.py
@@ -0,0 +1,54 @@
+import glob
+import json
+
+from wee_slack import ProcessNotImplemented
+
+def test_process_reply(monkeypatch, mock_websocket, realish_eventrouter):
+
+ eventrouter = realish_eventrouter
+
+ t = eventrouter.teams.keys()[0]
+ #u = eventrouter.teams[t].users.keys()[0]
+
+ #user = eventrouter.teams[t].users[u]
+ #print user
+
+ #delete charles so we can add him
+ del eventrouter.teams[t].users['U4096CBHC']
+
+ 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")
+
+ print datafiles
+ #assert False
+
+ notimplemented = set()
+
+ for fname in datafiles:
+ try:
+ print "####################"
+ data = json.loads(open(fname, 'r').read())
+ socket.add(data)
+ print data
+ eventrouter.receive_ws_callback(t)
+ eventrouter.handle_next()
+ except ProcessNotImplemented as e:
+ notimplemented.add(str(e))
+ #this handles some message data not existing - need to fix
+ except KeyError:
+ pass
+
+ if len(notimplemented) > 0:
+ print "####################"
+ print sorted(notimplemented)
+ print "####################"
+
+ #print len(eventrouter.queue)
+ assert len(eventrouter.teams[t].users) == 4
+
+
+