Beispiel #1
0
def test_on_part():
    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_part(cardinal, user, channel1, 'message')
    assert plugin.history[channel1] == {}
    assert plugin.history[channel2] == {
        user.nick: msg
    }

    plugin.on_part(cardinal, user, channel2, 'message')
    assert plugin.history[channel2] == {}
Beispiel #2
0
def test_on_part_no_history():
    channel = '#channel'
    user = user_info('nick', None, None)

    plugin = SedPlugin()
    cardinal = Mock()

    # make sure this doesn't raise
    plugin.on_part(cardinal, user, channel, 'message')
Beispiel #3
0
def test_on_part_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_part(cardinal, user, channel, 'message')