def test_on_quit_no_history(): channel = '#channel' user = user_info('nick', None, None) plugin = SedPlugin() assert plugin.history[channel] == {} cardinal = Mock() # make sure this doesn't raise plugin.on_quit(cardinal, user, 'message') assert plugin.history[channel] == {}
def test_on_quit(): channel1 = '#channel1' channel2 = '#channel2' user = user_info('nick', None, None) msg = 'msg' plugin = SedPlugin() cardinal = Mock() plugin.on_msg(cardinal, user, channel1, msg) plugin.on_msg(cardinal, user, channel2, msg) assert plugin.history[channel1] == {user.nick: msg} assert plugin.history[channel2] == {user.nick: msg} plugin.on_quit(cardinal, user, 'message') assert plugin.history[channel1] == {} assert plugin.history[channel2] == {}