aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_eventrouter.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2017-02-02 17:43:41 -0800
committerRyan Huber <rhuber@gmail.com>2017-02-02 17:43:41 -0800
commit4b6fe56a99b114cdacddd2429c83a9cee160c89e (patch)
treeb49da1bf90b02b48dee87a235b259278ade13858 /_pytest/test_eventrouter.py
parentdde53037734027abcc44d01175fecefda13dea14 (diff)
downloadwee-slack-4b6fe56a99b114cdacddd2429c83a9cee160c89e.tar.gz
that was super not fun to debug
Diffstat (limited to '_pytest/test_eventrouter.py')
-rw-r--r--_pytest/test_eventrouter.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/_pytest/test_eventrouter.py b/_pytest/test_eventrouter.py
index fc6a6a9..b235512 100644
--- a/_pytest/test_eventrouter.py
+++ b/_pytest/test_eventrouter.py
@@ -1,5 +1,4 @@
import pytest
-import pickle
from wee_slack import EventRouter, ProcessNotImplemented, SlackRequest
def test_EventRouter(mock_weechat):
@@ -35,22 +34,33 @@ def test_EventRouter(mock_weechat):
def test_EventRouterReceivedata(mock_weechat):
e = EventRouter()
- pickled_data = pickle.dumps(SlackRequest('xoxoxoxox', "rtm.startold", {"meh": "blah"}))
- e.receive_httprequest_callback(pickled_data, 1, -1, ' {"JSON": "MEH", ', 4)
+ context = e.store_context(SlackRequest('xoxoxoxox', "rtm.startold", {"meh": "blah"}))
+ print context
+ e.receive_httprequest_callback(context, 1, -1, ' {"JSON": "MEH", ', 4)
#print len(e.reply_buffer)
- e.receive_httprequest_callback(pickled_data, 1, -1, ' "JSON2": "MEH", ', 4)
+ context = e.store_context(SlackRequest('xoxoxoxox', "rtm.startold", {"meh": "blah"}))
+ print context
+ e.receive_httprequest_callback(context, 1, -1, ' "JSON2": "MEH", ', 4)
#print len(e.reply_buffer)
- e.receive_httprequest_callback(pickled_data, 1, 0, ' "JSON3": "MEH"}', 4)
+ context = e.store_context(SlackRequest('xoxoxoxox', "rtm.startold", {"meh": "blah"}))
+ print context
+ e.receive_httprequest_callback(context, 1, 0, ' "JSON3": "MEH"}', 4)
#print len(e.reply_buffer)
try:
e.handle_next()
+ e.handle_next()
+ e.handle_next()
+ e.handle_next()
except:
pass
- pickled_data = pickle.dumps(SlackRequest('xoxoxoxox', "rtm.start", {"meh": "blah"}))
+ print e.context
+ #assert False
+
+ context = e.store_context(SlackRequest('xoxoxoxox', "rtm.start", {"meh": "blah"}))
rtmstartdata = open('_pytest/data/http/rtm.start.json', 'r').read()
- e.receive_httprequest_callback(pickled_data, 1, 0, rtmstartdata[:5000], 4)
- e.receive_httprequest_callback(pickled_data, 1, 0, rtmstartdata[5000:], 4)
+ e.receive_httprequest_callback(context, 1, -1, rtmstartdata[:5000], 4)
+ e.receive_httprequest_callback(context, 1, 0, rtmstartdata[5000:], 4)
e.handle_next()
#print len(e.reply_buffer)