Ejemplo n.º 1
0
def test_not_a_substitute():
    user = user_info('user', None, None)
    channel = '#channel'

    plugin = SedPlugin()
    plugin.history[channel][user.nick] = 'doesnt matter'

    assert plugin.substitute(user, channel, 'foobar') == None
Ejemplo n.º 2
0
def test_substitute_modifiers(message, new_message):
    user = user_info('user', None, None)
    channel = '#channel'

    plugin = SedPlugin()
    plugin.history[channel][user.nick] = 'this is a test message'

    assert plugin.substitute(user, channel, message) == new_message
Ejemplo n.º 3
0
def test_substitute_escaping(message, new_message):
    user = user_info('user', None, None)
    channel = '#channel'

    plugin = SedPlugin()
    plugin.history[channel][user.nick] = 'hi/hey/hello'

    assert plugin.substitute(user, channel, message) == new_message
Ejemplo n.º 4
0
def test_substitution_doesnt_match():
    user = user_info('user', None, None)
    channel = '#channel'

    plugin = SedPlugin()
    plugin.history[channel][user.nick] = 'doesnt matter'

    assert plugin.substitute(user, channel, 's/foo/bar/') == 'doesnt matter'