<commit_before>import json
import pytest
import sys

sys.path.append(".")

#New stuff
from wee_slack import EventRouter
from wee_slack import SlackRequest
import wee_slack

class fakewebsocket(object):
    def __init__(self):
        self.returndata = []
        pass
    def add(self, data):
        self.returndata.append(data)
    def recv(self):
        return json.dumps(self.returndata.pop(0))
    def send(self, data):
        print "websocket received: {}".format(data)
        return

@pytest.fixture
def mock_websocket():
    return fakewebsocket()

@pytest.fixture
def realish_eventrouter(mock_weechat):
    e = EventRouter()
    context = e.store_context(SlackRequest('xoxoxoxox', "rtm.start", {"meh": "blah"}))
    rtmstartdata = open('_pytest/data/http/rtm.start.json', 'r').read()
    e.receive_httprequest_callback(context, 1, 0, rtmstartdata, 4)
    e.handle_next()
    #e.sc is just shortcuts to these items
    e.sc = {}
    e.sc["team_id"] = e.teams.keys()[0]<commit_msg>test: Empty eventrouter queue when initializing it<commit_after>import json
import pytest
import sys

sys.path.append(".")

#New stuff
from wee_slack import EventRouter
from wee_slack import SlackRequest
import wee_slack

class fakewebsocket(object):
    def __init__(self):
        self.returndata = []
        pass
    def add(self, data):
        self.returndata.append(data)
    def recv(self):
        return json.dumps(self.returndata.pop(0))
    def send(self, data):
        print "websocket received: {}".format(data)
        return

@pytest.fixture
def mock_websocket():
    return fakewebsocket()

@pytest.fixture
def realish_eventrouter(mock_weechat):
    e = EventRouter()
    context = e.store_context(SlackRequest('xoxoxoxox', "rtm.start", {"meh": "blah"}))
    rtmstartdata = open('_pytest/data/http/rtm.start.json', 'r').read()
    e.receive_httprequest_callback(context, 1, 0, rtmstartdata, 4)
    while len(e.queue):
        e.handle_next()
    #e.sc is just shortcuts to these items
    e.sc = {}
    e.sc["team_id"] = e.teams.keys()[0]
{'fraction_non_alphanumeric': 0.12945774303859306, 'fraction_numerical': 0.004885197850512946, 'mean_word_length': 3.591928251121076, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 4}}
{'dir': 'git-commits-cleaned', 'id': '2181003', 'n_tokens_mistral': 739, 'n_tokens_neox': 715, 'n_words': 157}