Exemplo n.º 1
0
def test_on_kick():
    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_kick(cardinal, user, channel1, user.nick, 'message')
    assert plugin.history[channel1] == {}
    assert plugin.history[channel2] == {
        user.nick: msg
    }

    plugin.on_kick(cardinal, user, channel2, user.nick, 'message')
    assert plugin.history[channel2] == {}
Exemplo n.º 2
0
def test_on_kick_no_history():
    channel = '#channel'
    user = user_info('nick', None, None)

    plugin = SedPlugin()
    cardinal = Mock()

    # make sure this doesn't raise
    plugin.on_kick(cardinal, user, channel, user.nick, 'message')
Exemplo n.º 3
0
def test_on_kick_self_no_history():
    cardinal = Mock()
    cardinal.nickname = 'Cardinal'

    channel = '#channel'
    user = user_info(cardinal.nickname, None, None)
    msg = 'msg'

    plugin = SedPlugin()

    # make sure this doesn't raise
    plugin.on_kick(cardinal, user, channel, user.nick, 'message')