Ejemplo n.º 1
0
def test_rss_config_templates_list(bot):
    bot.memory['rss']['templates']['t'] = '†{}†'
    args = ['config', 'templates']
    rss._rss_config(bot, args)
    expected = 't=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};'
    expected += 't=p|({});t=s|{};t=t|†{}†;t=y|%16→%16 {}\n'
    expected += rss._config_templates_example(bot) + '\n'
    assert expected == bot.output
Ejemplo n.º 2
0
def test_rss_config_templates_list(bot):
    bot.memory["rss"]["templates"]["t"] = "†{}†"
    args = ["config", "templates"]
    rss._rss_config(bot, args)
    expected = "t=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};"
    expected += "t=p|({});t=s|{};t=t|†{}†;t=y|%16→%16 {}\n"
    expected += rss._config_templates_example(bot) + "\n"
    assert expected == bot.output
Ejemplo n.º 3
0
def test_rss_config_templates_output_escape_character(bot):
    template = rss.ESCAPE_CHARACTER + rss.ESCAPE_CHARACTER + "{}"
    bot.memory["rss"]["templates"]["s"] = template
    args = ["config", "templates"]
    rss._rss_config(bot, args)
    expected = "t=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};"
    expected += "t=p|({});t=s|%%{};t=t|{};t=y|%16→%16 {}\n"
    expected += rss._config_templates_example(bot) + "\n"
    assert expected == bot.output
Ejemplo n.º 4
0
def test_rss_config_templates_pink_on_silver(bot):
    template = rss.ESCAPE_CHARACTER + "13$15{}" + rss.ESCAPE_CHARACTER + "20"
    bot.memory["rss"]["templates"]["d"] = template
    args = ["config", "templates"]
    rss._rss_config(bot, args)
    expected = "t=a|<{}>;t=d|%13$15{}%20;t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};"
    expected += "t=p|({});t=s|{};t=t|{};t=y|%16→%16 {}\n"
    expected += rss._config_templates_example(bot) + "\n"
    assert expected == bot.output
Ejemplo n.º 5
0
def test_rss_config_templates_invalid_backgroundcolor(bot):
    template = rss.ESCAPE_CHARACTER + "04$20{}" + rss.ESCAPE_CHARACTER + "20"
    bot.memory["rss"]["templates"]["d"] = template
    args = ["config", "templates"]
    rss._rss_config(bot, args)
    expected = "t=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};"
    expected += "t=p|({});t=s|{};t=t|{};t=y|%16→%16 {}\n"
    expected += rss._config_templates_example(bot) + "\n"
    assert expected == bot.output
Ejemplo n.º 6
0
def test_rss_config_templates_output_dollar_after_control_sequence(bot):
    template = rss.ESCAPE_CHARACTER + "17" + rss.ESCAPE_CHARACTER + "${}%16"
    bot.memory["rss"]["templates"]["s"] = template
    args = ["config", "templates"]
    rss._rss_config(bot, args)
    expected = "t=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};"
    expected += "t=p|({});t=s|%17%${}%16;t=t|{};t=y|%16→%16 {}\n"
    expected += rss._config_templates_example(bot) + "\n"
    assert expected == bot.output
Ejemplo n.º 7
0
def test_rss_config_templates_output_dollar_after_control_sequence(bot):
    template = rss.ESCAPE_CHARACTER + '17' + rss.ESCAPE_CHARACTER + '${}%16'
    bot.memory['rss']['templates']['s'] = template
    args = ['config', 'templates']
    rss._rss_config(bot, args)
    expected = 't=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};'
    expected += 't=p|({});t=s|%17%${}%16;t=t|{};t=y|%16→%16 {}\n'
    expected += rss._config_templates_example(bot) + '\n'
    assert expected == bot.output
Ejemplo n.º 8
0
def test_rss_config_templates_output_escape_character(bot):
    template = rss.ESCAPE_CHARACTER + rss.ESCAPE_CHARACTER + '{}'
    bot.memory['rss']['templates']['s'] = template
    args = ['config', 'templates']
    rss._rss_config(bot, args)
    expected = 't=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};'
    expected += 't=p|({});t=s|%%{};t=t|{};t=y|%16→%16 {}\n'
    expected += rss._config_templates_example(bot) + '\n'
    assert expected == bot.output
Ejemplo n.º 9
0
def test_rss_config_templates_pink_on_silver(bot):
    template = rss.ESCAPE_CHARACTER + '13$15{}' + rss.ESCAPE_CHARACTER + '20'
    bot.memory['rss']['templates']['d'] = template
    args = ['config', 'templates']
    rss._rss_config(bot, args)
    expected = 't=a|<{}>;t=d|%13$15{}%20;t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};'
    expected += 't=p|({});t=s|{};t=t|{};t=y|%16→%16 {}\n'
    expected += rss._config_templates_example(bot) + '\n'
    assert expected == bot.output
Ejemplo n.º 10
0
def test_rss_config_templates_invalid_backgroundcolor(bot):
    template = rss.ESCAPE_CHARACTER + '04$20{}' + rss.ESCAPE_CHARACTER + '20'
    bot.memory['rss']['templates']['d'] = template
    args = ['config', 'templates']
    rss._rss_config(bot, args)
    expected = 't=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};'
    expected += 't=p|({});t=s|{};t=t|{};t=y|%16→%16 {}\n'
    expected += rss._config_templates_example(bot) + '\n'
    assert expected == bot.output
Ejemplo n.º 11
0
def test_config_set_templates_get(bot):
    templates = "t=t|≈{}≈;t=s|√{}"
    rss._config_set_templates(bot, templates)
    bot.output = ""
    rss._config_get_templates(bot)
    expected_dict = dict()
    for t in rss.TEMPLATES_DEFAULT:
        expected_dict[t] = rss.TEMPLATES_DEFAULT[t]
    expected_dict["s"] = "√{}"
    expected_dict["t"] = "≈{}≈"
    expected_list = list()
    for t in expected_dict:
        expected_list.append("t=" + t + "|" + expected_dict[t])
    expected = ";".join(sorted(expected_list)) + "\n"
    expected += rss._config_templates_example(bot) + "\n"
    assert expected == bot.output
Ejemplo n.º 12
0
def test_config_set_templates_get(bot):
    templates = 't=t|≈{}≈;t=s|√{}'
    rss._config_set_templates(bot, templates)
    bot.output = ''
    rss._config_get_templates(bot)
    expected_dict = dict()
    for t in rss.TEMPLATES_DEFAULT:
        expected_dict[t] = rss.TEMPLATES_DEFAULT[t]
    expected_dict['s'] = '√{}'
    expected_dict['t'] = '≈{}≈'
    expected_list = list()
    for t in expected_dict:
        expected_list.append('t=' + t + '|' + expected_dict[t])
    expected = ';'.join(sorted(expected_list)) + '\n'
    expected += rss._config_templates_example(bot) + '\n'
    assert expected == bot.output
Ejemplo n.º 13
0
def test_config_templates_example(bot):
    example = rss._config_templates_example(bot)
    expected = "<Author> Description \x02[Feedname]\x02 GUID \x02→\x02 https://github.com/RebelCodeBase/sopel-rss (2016-09-03 10:00) Description Title \x02→\x02 https://tinyurl.com/govvpmm"
    assert expected == example
Ejemplo n.º 14
0
def test_rss_global_config_templates(bot):
    rss._rss(bot, ["config", "templates"])
    expected = "t=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};"
    expected += "t=p|({});t=s|{};t=t|{};t=y|%16→%16 {}\n"
    expected += rss._config_templates_example(bot) + "\n"
    assert expected == bot.output
Ejemplo n.º 15
0
def test_config_templates_example(bot):
    example = rss._config_templates_example(bot)
    expected = '<Author> Description \x02[Feedname]\x02 GUID \x02→\x02 https://github.com/RebelCodeBase/sopel-rss (2016-09-03 10:00) Description Title \x02→\x02 https://tinyurl.com/govvpmm'
    assert expected == example
Ejemplo n.º 16
0
def test_rss_global_config_templates(bot):
    rss._rss(bot, ['config', 'templates'])
    expected = 't=a|<{}>;t=d|{};t=f|%16[{}]%16;t=g|{};t=l|%16→%16 {};'
    expected += 't=p|({});t=s|{};t=t|{};t=y|%16→%16 {}\n'
    expected += rss._config_templates_example(bot) + '\n'
    assert expected == bot.output