def test_loop_hook(): hooks = limbo.init_plugins("test/plugins") server = limbo.FakeServer(hooks=hooks) slack = limbo.FakeSlack() limbo.loop(server, test_loop=1) eq_(server._loop_plugin_ran, True)
def test_loop_hook(): hooks = limbo.init_plugins("test/plugins") server = limbo.FakeServer(hooks=hooks) slack = limbo.FakeSlack() limbo.loop(server, test_loop=1) assert server._loop_plugin_ran == True
def test_loop_hook(): hooks = limbo.init_plugins("test/plugins") server = limbo.FakeServer(hooks=hooks) slack = limbo.FakeSlack() metrics = limbo.NullMetrics() limbo.loop(server, metrics, test_loop=1) assert server._loop_plugin_ran == True assert metrics.count == 0
def test_event_count(): msg = u"!echo Iñtërnâtiônàlizætiøn bot" oldmsg = u"old message" newmsg = u"!echo new message" events = [[{ "channel": "none", "user": "******", "text": msg }, { "channel": "none", "user": "******", "type": "message", "subtype": "channel_join", "text": "User has joined" }, { "channel": "none", "user": "******", "type": "member_left_channel" }, { "channel": "none", "type": "message", "subtype": "message_changed", "previous_message": { "text": oldmsg }, "message": { "text": newmsg, "user": "******" } }]] slack = limbo.FakeSlack(events=events) hooks = limbo.init_plugins("test/plugins") server = limbo.FakeServer(hooks=hooks, slack=slack) metrics = limbo.NullMetrics() limbo.loop(server, metrics, test_loop=1) assert metrics.count == 4