def test_SlackRequest():
    s = SlackRequest('xoxoxoxox', "blah.get", {"meh": "blah"})
    print s

    e = EventRouter()
    e.receive(s)
    e.handle_next()
Exemplo n.º 2
0
def test_SlackRequest():
    s = SlackRequest('xoxoxoxox', "blah.get", {"meh": "blah"})
    print s

    e = EventRouter()
    e.receive(s)
    e.handle_next()
Exemplo n.º 3
0
def test_EventRouter(mock_weechat):
    # Sending valid object adds to the queue.
    e = EventRouter()
    e.receive({})
    assert len(e.queue) == 1

    # Handling an event removes from the queue.
    e = EventRouter()
    # Create a function to test we are called
    e.proc['testfunc'] = lambda x, y: x
    e.receive({"type": "testfunc"})
    e.handle_next()
    assert len(e.queue) == 0

    # Handling a local event removes from the queue.
    e = EventRouter()
    # Create a function to test we are called
    e.proc['local_testfunc'] = lambda x, y: x
    e.receive({"type": "local_testfunc"})
    e.handle_next()
    assert len(e.queue) == 0

    # Handling an event without an associated processor
    # shouldn't raise an exception.
    e = EventRouter()
    # Create a function to test we are called
    e.receive({"type": "testfunc"})
    e.handle_next()