def test_dispatch_default_msg_plugin(dispatcher, monkeypatch): monkeypatch.setattr('smackbot.dispatcher.Message', FakeMessage) dispatcher.dispatch_msg( ['respond_to', { 'text': 'default_okay', 'channel': FAKE_CHANNEL }]) assert dispatcher._client.rtm_messages == [(FAKE_CHANNEL, 'default_okay')]
def test_dispatch_msg_exception(dispatcher, monkeypatch): monkeypatch.setattr('smackbot.dispatcher.Message', FakeMessage) dispatcher.dispatch_msg( ['reply_to', { 'text': 'raising', 'channel': FAKE_CHANNEL }]) assert len(dispatcher._client.rtm_messages) == 1 error = dispatcher._client.rtm_messages[0] assert error[0] == FAKE_CHANNEL assert 'RuntimeError' in error[1]