aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2017-02-01 19:14:52 -0800
committerRyan Huber <rhuber@gmail.com>2017-02-01 19:14:52 -0800
commita97b310f586a498de7a2d5d9a0018dfeaa21d980 (patch)
tree197fcd9231314adf4cd7d0609cda36ab88b7fac3
parent8916744f0335bfbdddcbe87703eb518891d69503 (diff)
downloadwee-slack-a97b310f586a498de7a2d5d9a0018dfeaa21d980.tar.gz
more test cases + recorder outputs json properly
-rw-r--r--_pytest/data/websocket/1486004888.32-presence_change.json1
-rw-r--r--_pytest/data/websocket/1486004888.41-reconnect_url.json1
-rw-r--r--_pytest/data/websocket/1486004935.63-presence_change.json1
-rw-r--r--_pytest/data/websocket/1486004950.43-message.json1
-rw-r--r--_pytest/data/websocket/1486004992.49-user_typing.json1
-rw-r--r--_pytest/data/websocket/1486004995.69-user_typing.json1
-rw-r--r--_pytest/data/websocket/1486004999.55-user_typing.json1
-rw-r--r--_pytest/data/websocket/1486004999.95-message.json1
-rw-r--r--_pytest/data/websocket/1486005004.03-user_typing.json1
-rw-r--r--_pytest/data/websocket/1486005007.16-user_typing.json1
-rw-r--r--_pytest/data/websocket/1486005008.45-reconnect_url.json1
-rw-r--r--_pytest/data/websocket/1486005009.0-message.json1
-rw-r--r--_pytest/data/websocket/1486005096.38-accounts_changed.json1
-rw-r--r--_pytest/data/websocket/1486005099.81-presence_change.json1
-rw-r--r--_pytest/data/websocket/1486005104.63-channel_marked.json1
-rw-r--r--_pytest/data/websocket/1486005109.58-im_marked.json1
-rw-r--r--_pytest/data/websocket/1486005119.69-im_marked.json1
-rw-r--r--_pytest/data/websocket/1486005124.51-mpim_marked.json1
-rw-r--r--_pytest/data/websocket/1486005124.59-group_marked.json1
-rw-r--r--_pytest/data/websocket/1486005124.67-group_marked.json1
-rw-r--r--_pytest/data/websocket/1486005188.48-reconnect_url.json1
-rw-r--r--_pytest/test_everything.py4
-rw-r--r--wee_slack.py2
23 files changed, 25 insertions, 2 deletions
diff --git a/_pytest/data/websocket/1486004888.32-presence_change.json b/_pytest/data/websocket/1486004888.32-presence_change.json
new file mode 100644
index 0000000..c52679d
--- /dev/null
+++ b/_pytest/data/websocket/1486004888.32-presence_change.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "presence_change", "user": "U3ZKBBDL5", "presence": "active"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486004888.41-reconnect_url.json b/_pytest/data/websocket/1486004888.41-reconnect_url.json
new file mode 100644
index 0000000..ae7d1f1
--- /dev/null
+++ b/_pytest/data/websocket/1486004888.41-reconnect_url.json
@@ -0,0 +1 @@
+{"url": "wss://mpmulti-3z94.slack-msgs.com/websocket/v0jzriT0ZxrHn6tVO4Dpi96hr54r8ZOaGklQfQN2G_D1kO6mEMs7KXXfUTax40_5zkAA6XTfZpSsjo3TGVD0hcFrhhSwhTsbFvs6W2m5pHH8hfaLJuKFkfPZySnprXsHCXDNKMWyTKMFTZ_CAUKjyhJWzY9Z708pAGB8oy6YMcE=", "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "reconnect_url"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486004935.63-presence_change.json b/_pytest/data/websocket/1486004935.63-presence_change.json
new file mode 100644
index 0000000..eca19bc
--- /dev/null
+++ b/_pytest/data/websocket/1486004935.63-presence_change.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "presence_change", "user": "U407ABLLW", "presence": "active"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486004950.43-message.json b/_pytest/data/websocket/1486004950.43-message.json
new file mode 100644
index 0000000..ce13b3f
--- /dev/null
+++ b/_pytest/data/websocket/1486004950.43-message.json
@@ -0,0 +1 @@
+{"text": "is here", "ts": "1486004950.000002", "subtype": "me_message", "user": "U407ABLLW", "team": "T3YS5EAL9", "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "message", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486004992.49-user_typing.json b/_pytest/data/websocket/1486004992.49-user_typing.json
new file mode 100644
index 0000000..859d905
--- /dev/null
+++ b/_pytest/data/websocket/1486004992.49-user_typing.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "user_typing", "user": "U407ABLLW", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486004995.69-user_typing.json b/_pytest/data/websocket/1486004995.69-user_typing.json
new file mode 100644
index 0000000..859d905
--- /dev/null
+++ b/_pytest/data/websocket/1486004995.69-user_typing.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "user_typing", "user": "U407ABLLW", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486004999.55-user_typing.json b/_pytest/data/websocket/1486004999.55-user_typing.json
new file mode 100644
index 0000000..859d905
--- /dev/null
+++ b/_pytest/data/websocket/1486004999.55-user_typing.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "user_typing", "user": "U407ABLLW", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486004999.95-message.json b/_pytest/data/websocket/1486004999.95-message.json
new file mode 100644
index 0000000..b906b1b
--- /dev/null
+++ b/_pytest/data/websocket/1486004999.95-message.json
@@ -0,0 +1 @@
+{"text": "this _is_ a *formatted* message", "ts": "1486004999.000003", "user": "U407ABLLW", "team": "T3YS5EAL9", "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "message", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005004.03-user_typing.json b/_pytest/data/websocket/1486005004.03-user_typing.json
new file mode 100644
index 0000000..859d905
--- /dev/null
+++ b/_pytest/data/websocket/1486005004.03-user_typing.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "user_typing", "user": "U407ABLLW", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005007.16-user_typing.json b/_pytest/data/websocket/1486005007.16-user_typing.json
new file mode 100644
index 0000000..859d905
--- /dev/null
+++ b/_pytest/data/websocket/1486005007.16-user_typing.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "user_typing", "user": "U407ABLLW", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005008.45-reconnect_url.json b/_pytest/data/websocket/1486005008.45-reconnect_url.json
new file mode 100644
index 0000000..bafddd6
--- /dev/null
+++ b/_pytest/data/websocket/1486005008.45-reconnect_url.json
@@ -0,0 +1 @@
+{"url": "wss://mpmulti-14cn.slack-msgs.com/websocket/28Rgy5cmEP5N50Jq5Jk0YSCKRdC_PTNklbuT07jR1-BP0vpyvFzhUFpTqbl7pxbMkSCE1rv8OMQMKsWyHgDnoJ9KANYeHweBmRAsL41zPn-dJnJmTpnm670fgK1Nr-tVsfXpo7ql0cbstLR_KWDHr8zt1B2TbqIUeoikNN6oBiY=", "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "reconnect_url"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005009.0-message.json b/_pytest/data/websocket/1486005009.0-message.json
new file mode 100644
index 0000000..10c96e9
--- /dev/null
+++ b/_pytest/data/websocket/1486005009.0-message.json
@@ -0,0 +1 @@
+{"text": "this is ~strikethrough~", "ts": "1486005008.000004", "user": "U407ABLLW", "team": "T3YS5EAL9", "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "message", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005096.38-accounts_changed.json b/_pytest/data/websocket/1486005096.38-accounts_changed.json
new file mode 100644
index 0000000..1d0086c
--- /dev/null
+++ b/_pytest/data/websocket/1486005096.38-accounts_changed.json
@@ -0,0 +1 @@
+{"event_ts": "1486005096.312395", "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "accounts_changed"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005099.81-presence_change.json b/_pytest/data/websocket/1486005099.81-presence_change.json
new file mode 100644
index 0000000..c52679d
--- /dev/null
+++ b/_pytest/data/websocket/1486005099.81-presence_change.json
@@ -0,0 +1 @@
+{"wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "presence_change", "user": "U3ZKBBDL5", "presence": "active"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005104.63-channel_marked.json b/_pytest/data/websocket/1486005104.63-channel_marked.json
new file mode 100644
index 0000000..956e886
--- /dev/null
+++ b/_pytest/data/websocket/1486005104.63-channel_marked.json
@@ -0,0 +1 @@
+{"mention_count": 0, "event_ts": "1486005104.313131", "ts": "1486005008.000004", "unread_count": 0, "num_mentions": 0, "mention_count_display": 0, "unread_count_display": 0, "num_mentions_display": 0, "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "channel_marked", "channel": "C407ABS94"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005109.58-im_marked.json b/_pytest/data/websocket/1486005109.58-im_marked.json
new file mode 100644
index 0000000..b74c742
--- /dev/null
+++ b/_pytest/data/websocket/1486005109.58-im_marked.json
@@ -0,0 +1 @@
+{"event_ts": "1486005109.313169", "ts": "1485975735.000002", "dm_count": 0, "mention_count_display": 0, "unread_count_display": 0, "num_mentions_display": 0, "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "im_marked", "channel": "D3ZK1D8JY"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005119.69-im_marked.json b/_pytest/data/websocket/1486005119.69-im_marked.json
new file mode 100644
index 0000000..802f4c9
--- /dev/null
+++ b/_pytest/data/websocket/1486005119.69-im_marked.json
@@ -0,0 +1 @@
+{"event_ts": "1486005119.313254", "ts": "1485975421.000002", "dm_count": 0, "mention_count_display": 0, "unread_count_display": 0, "num_mentions_display": 0, "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "im_marked", "channel": "D3ZEQULHZ"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005124.51-mpim_marked.json b/_pytest/data/websocket/1486005124.51-mpim_marked.json
new file mode 100644
index 0000000..3357683
--- /dev/null
+++ b/_pytest/data/websocket/1486005124.51-mpim_marked.json
@@ -0,0 +1 @@
+{"mention_count": 0, "event_ts": "1486005124.313290", "is_mpim": true, "ts": "1485975715.000005", "unread_count": 0, "num_mentions": 0, "mention_count_display": 0, "unread_count_display": 0, "num_mentions_display": 0, "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "mpim_marked", "channel": "G3ZGMF4RZ"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005124.59-group_marked.json b/_pytest/data/websocket/1486005124.59-group_marked.json
new file mode 100644
index 0000000..8efe97a
--- /dev/null
+++ b/_pytest/data/websocket/1486005124.59-group_marked.json
@@ -0,0 +1 @@
+{"mention_count": 0, "event_ts": "1486005124.313291", "is_mpim": true, "ts": "1485975715.000005", "unread_count": 0, "num_mentions": 0, "mention_count_display": 0, "unread_count_display": 0, "num_mentions_display": 0, "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "group_marked", "channel": "G3ZGMF4RZ"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005124.67-group_marked.json b/_pytest/data/websocket/1486005124.67-group_marked.json
new file mode 100644
index 0000000..7753500
--- /dev/null
+++ b/_pytest/data/websocket/1486005124.67-group_marked.json
@@ -0,0 +1 @@
+{"mention_count": 0, "event_ts": "1486005124.313292", "is_mpim": false, "ts": "1485975492.000004", "unread_count": 0, "num_mentions": 0, "mention_count_display": 0, "unread_count_display": 0, "num_mentions_display": 0, "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "group_marked", "channel": "G3ZJKP7GA"} \ No newline at end of file
diff --git a/_pytest/data/websocket/1486005188.48-reconnect_url.json b/_pytest/data/websocket/1486005188.48-reconnect_url.json
new file mode 100644
index 0000000..1bdbd43
--- /dev/null
+++ b/_pytest/data/websocket/1486005188.48-reconnect_url.json
@@ -0,0 +1 @@
+{"url": "wss://mpmulti-lz08.slack-msgs.com/websocket/dHqqUxSrrgTCJI7af1mYz7ECm0-rxu4GOIPmnYwK_K9uWOwBXvF54joGrhpZcUjrJ913Vx01Wh6Ta4u5-bC4-Zn9H9wXklCc6mDDf8iJJmXKC2nWZYaP8jOTzPRNM97iISoe5LNSXl_JB-9J5DSSwEdBh7eQ0SEFeko7NxXP6_o=", "wee_slack_metadata": {"team": "d80c2b6c3127dbb1991917394ed219e8212a2606"}, "type": "reconnect_url"} \ No newline at end of file
diff --git a/_pytest/test_everything.py b/_pytest/test_everything.py
index fd29850..039be54 100644
--- a/_pytest/test_everything.py
+++ b/_pytest/test_everything.py
@@ -33,13 +33,15 @@ def test_process_message(monkeypatch, realish_eventrouter, mock_websocket):
except ProcessNotImplemented as e:
notimplemented.add(str(e))
-
if len(notimplemented) > 0:
print "####################"
print sorted(notimplemented)
print "####################"
#assert False
+ print eventrouter.queue
+ assert False
+
diff --git a/wee_slack.py b/wee_slack.py
index 2d059a1..98941c7 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -166,7 +166,7 @@ class EventRouter(object):
now = time.time()
mtype = message_json.get('type', 'unknown')
f = open('{}/{}-{}.json'.format(RECORD_DIR, now, mtype), 'w')
- f.write("{}".format(message_json))
+ f.write("{}".format(json.dumps(message_json)))
f.close()
self.receive_json(json.dumps(message_json))
except WebSocketConnectionClosedException: