aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_presencechange.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2017-04-12 16:47:43 +0000
committerRyan Huber <rhuber@gmail.com>2017-04-12 16:47:43 +0000
commit95fa084893660b655388604084f082a080f1ba32 (patch)
tree8c667c21f591572052f6b3a046c1b94712285c40 /_pytest/test_presencechange.py
parent01beb42fec5c6dbfc0d8c53ce1de88b48b48f6db (diff)
downloadwee-slack-95fa084893660b655388604084f082a080f1ba32.tar.gz
massssssssive merge of the new codebase
Diffstat (limited to '_pytest/test_presencechange.py')
-rw-r--r--_pytest/test_presencechange.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/_pytest/test_presencechange.py b/_pytest/test_presencechange.py
new file mode 100644
index 0000000..b4202fa
--- /dev/null
+++ b/_pytest/test_presencechange.py
@@ -0,0 +1,31 @@
+
+def test_PresenceChange(monkeypatch, 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({
+ "type": "presence_change",
+ "user": user.identifier,
+ "presence": "active",
+ })
+ socket.add({
+ "type": "presence_change",
+ "user": user.identifier,
+ "presence": "away",
+ })
+
+ e.receive_ws_callback(t)
+ e.handle_next()
+ assert e.teams[t].users[u].presence == "active"
+
+ e.receive_ws_callback(t)
+ e.handle_next()
+ assert e.teams[t].users[u].presence == "away"