예제 #1
0
def test_rss_global_help_synopsis_help(bot):
    rss._rss(bot, ['help'])
    expected = rss.COMMANDS['help']['synopsis'].format(
        bot.config.core.prefix) + '\n'
    expected += rss.MESSAGES['command_is_one_of'].format('|'.join(
        sorted(rss.COMMANDS.keys()))) + '\n'
    assert expected == bot.output
예제 #2
0
def test_rss_global_formats_feed(bot):
    rss._rss(bot, ['formats', 'feed1', 'f=apl+atl'])
    bot.output = ''
    args = ['config', 'feeds']
    rss._rss_config(bot, args)
    expected = '#channel1' + rss.CONFIG_SEPARATOR + 'feed1' + rss.CONFIG_SEPARATOR + 'http://www.site1.com/feed' + rss.CONFIG_SEPARATOR + 'f=apl+atl\n'
    assert expected == bot.output
예제 #3
0
def test_rss_global_too_many_parameters(bot):
    rss._rss(bot, [
        'add', '#channel', 'feedname', FEED_VALID, 'f=fl+ftl', 'fifth_argument'
    ])
    expected = rss.COMMANDS['add']['synopsis'].format(
        bot.config.core.prefix) + '\n'
    assert expected == bot.output
예제 #4
0
def test_rss_global_join(bot):
    rss._rss(bot, ['join'])
    channels = []
    for feed in bot.memory['rss']['feeds']:
        feedchannel = bot.memory['rss']['feeds'][feed]['channel']
        if feedchannel not in channels:
            channels.append(feedchannel)
    assert channels == bot.config.core.channels
예제 #5
0
def test_rss_global_join(bot):
    rss._rss(bot, ["join"])
    channels = []
    for feed in bot.memory["rss"]["feeds"]:
        feedchannel = bot.memory["rss"]["feeds"][feed]["channel"]
        if feedchannel not in channels:
            channels.append(feedchannel)
    assert channels == bot.config.core.channels
예제 #6
0
def test_rss_global_list_feed_options(bot):
    rss._rss(bot, ["add", "#channel", "feed", FEED_VALID])
    rss._rss(bot, ["formats", "feed", "f=l+tl"])
    rss._rss(bot, ["templates", "feed", "t=t|%06[{}]%20"])
    bot.output = ""
    rss._rss(bot, ["list", "feed"])
    expected = "#channel feed " + FEED_VALID + " f=l+tl;t=t|%06[{}]%20\n"
    assert expected == bot.output
예제 #7
0
def test_rss_global_formats_feed(bot):
    rss._rss(bot, ["formats", "feed1", "f=apl+atl"])
    bot.output = ""
    args = ["config", "feeds"]
    rss._rss_config(bot, args)
    expected = (
        "#channel1"
        + rss.CONFIG_SEPARATOR
        + "feed1"
        + rss.CONFIG_SEPARATOR
        + "http://www.site1.com/feed"
        + rss.CONFIG_SEPARATOR
        + "f=apl+atl\n"
    )
    assert expected == bot.output
예제 #8
0
def test_rss_global_list_feed_options(bot):
    rss._rss(bot, ['add', '#channel', 'feed', FEED_VALID])
    rss._rss(bot, ['formats', 'feed', 'f=l+tl'])
    rss._rss(bot, ['templates', 'feed', 't=t|%06[{}]%20'])
    bot.output = ''
    rss._rss(bot, ['list', 'feed'])
    expected = '#channel feed ' + FEED_VALID + ' f=l+tl;t=t|%06[{}]%20\n'
    assert expected == bot.output
예제 #9
0
def test_rss_global_feed_delete(bot):
    rss._rss(bot, ["add", "#channel", "feedname", FEED_VALID])
    rss._rss(bot, ["del", "feedname"])
    assert rss._feed_exists(bot, "feedname") == False
예제 #10
0
def test_rss_global_feed_add(bot):
    rss._rss(bot, ["add", "#channel", "feedname", FEED_VALID])
    assert rss._feed_exists(bot, "feedname") == True
예제 #11
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
예제 #12
0
def test_rss_global_formats_set(bot):
    rss._rss(bot, ['formats', 'feed1', 'f=asl+als'])
    format_new = bot.memory['rss']['options']['feed1'].get_format()
    assert 'f=asl+als' == format_new
예제 #13
0
def test_rss_global_list_feed(bot):
    rss._rss(bot, ["list", "feed1"])
    expected = "#channel1 feed1 http://www.site1.com/feed\n"
    assert expected == bot.output
예제 #14
0
def test_rss_global_help_synopsis_help(bot):
    rss._rss(bot, ["help"])
    expected = rss.COMMANDS["help"]["synopsis"].format(bot.config.core.prefix) + "\n"
    expected += rss.MESSAGES["command_is_one_of"].format("|".join(sorted(rss.COMMANDS.keys()))) + "\n"
    assert expected == bot.output
예제 #15
0
def test_rss_global_templates_get(bot):
    rss._rss(bot, ['templates', 'feed1'])
    assert '' == bot.output
예제 #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
예제 #17
0
def test_rss_global_list_feed(bot):
    rss._rss(bot, ['list', 'feed1'])
    expected = '#channel1 feed1 http://www.site1.com/feed\n'
    assert expected == bot.output
예제 #18
0
def test_rss_global_feed_add(bot):
    rss._rss(bot, ['add', '#channel', 'feedname', FEED_VALID])
    assert rss._feed_exists(bot, 'feedname') == True
예제 #19
0
def test_rss_global_get_post_feed_items(bot):
    rss._rss(bot, ['add', '#channel', 'feedname', FEED_VALID])
    bot.output = ''
    rss._rss(bot, ['get', 'feedname'])
    expected = '\x02[feedname]\x02 Title 1 \x02→\x02 http://www.site1.com/article1\n\x02[feedname]\x02 Title 2 \x02→\x02 http://www.site1.com/article2\n\x02[feedname]\x02 Title 3 \x02→\x02 http://www.site1.com/article3\n'
    assert expected == bot.output
예제 #20
0
def test_rss_global_feed_delete(bot):
    rss._rss(bot, ['add', '#channel', 'feedname', FEED_VALID])
    rss._rss(bot, ['del', 'feedname'])
    assert rss._feed_exists(bot, 'feedname') == False
예제 #21
0
def test_rss_global_fields_get(bot):
    rss._rss(bot, ["fields", "feed1"])
    expected = rss.MESSAGES["fields_of_feed"].format("feed1", "fadglpsty") + "\n"
    assert expected == bot.output
예제 #22
0
def test_rss_global_templates_get(bot):
    rss._rss(bot, ["templates", "feed1"])
    assert "" == bot.output
예제 #23
0
def test_rss_global_formats_set(bot):
    rss._rss(bot, ["formats", "feed1", "f=asl+als"])
    format_new = bot.memory["rss"]["options"]["feed1"].get_format()
    assert "f=asl+als" == format_new
예제 #24
0
def test_rss_global_too_few_parameters(bot):
    rss._rss(bot, ['add', '#channel', 'feedname'])
    expected = rss.COMMANDS['add']['synopsis'].format(
        bot.config.core.prefix) + '\n'
    assert expected == bot.output
예제 #25
0
def test_rss_global_get_post_feed_items(bot):
    rss._rss(bot, ["add", "#channel", "feedname", FEED_VALID])
    bot.output = ""
    rss._rss(bot, ["get", "feedname"])
    expected = "\x02[feedname]\x02 Title 1 \x02→\x02 http://www.site1.com/article1\n\x02[feedname]\x02 Title 2 \x02→\x02 http://www.site1.com/article2\n\x02[feedname]\x02 Title 3 \x02→\x02 http://www.site1.com/article3\n"
    assert expected == bot.output
예제 #26
0
def test_rss_global_too_few_parameters(bot):
    rss._rss(bot, ["add", "#channel", "feedname"])
    expected = rss.COMMANDS["add"]["synopsis"].format(bot.config.core.prefix) + "\n"
    assert expected == bot.output
예제 #27
0
def test_rss_global_color(bot):
    rss._rss(bot, ['colors'])
    expected = '\x0301,00 00: white \x0f\x0300,01 01: black \x0f\x0300,02 02: blue \x0f\x0300,03 03: green \x0f\x0301,04 04: red \x0f\x0300,05 05: brown \x0f\x0300,06 06: purple \x0f\x0301,07 07: orange \x0f\x0301,08 08: yellow \x0f\x0301,09 09: lime \x0f\x0300,10 10: cyan \x0f\x0301,11 11: aqua \x0f\x0301,12 12: azure \x0f\x0301,13 13: pink \x0f\x0300,14 14: grey \x0f\x0301,15 15: silver \x0f\x0300,01 16: \x02bold\x02 \x0f\x0301,00 17: \x1ditalic\x1d \x0f\x0300,01 18: \x1funderline\x1f \x0f\n'
    assert expected == bot.output
예제 #28
0
def test_rss_global_color(bot):
    rss._rss(bot, ["colors"])
    expected = "\x0301,00 00: white \x0f\x0300,01 01: black \x0f\x0300,02 02: blue \x0f\x0300,03 03: green \x0f\x0301,04 04: red \x0f\x0300,05 05: brown \x0f\x0300,06 06: purple \x0f\x0301,07 07: orange \x0f\x0301,08 08: yellow \x0f\x0301,09 09: lime \x0f\x0300,10 10: cyan \x0f\x0301,11 11: aqua \x0f\x0301,12 12: azure \x0f\x0301,13 13: pink \x0f\x0300,14 14: grey \x0f\x0301,15 15: silver \x0f\x0300,01 16: \x02bold\x02 \x0f\x0301,00 17: \x1ditalic\x1d \x0f\x0300,01 18: \x1funderline\x1f \x0f\n"
    assert expected == bot.output
예제 #29
0
def test_rss_global_update_update(bot_rss_update):
    rss._rss(bot_rss_update, ['update'])
    expected = '\x02[feed1]\x02 Title 1 \x02→\x02 http://www.site1.com/article1\n\x02[feed1]\x02 Title 2 \x02→\x02 http://www.site1.com/article2\n\x02[feed1]\x02 Title 3 \x02→\x02 http://www.site1.com/article3\n'
    assert expected == bot_rss_update.output
예제 #30
0
def test_rss_global_fields_get(bot):
    rss._rss(bot, ['fields', 'feed1'])
    expected = rss.MESSAGES['fields_of_feed'].format('feed1',
                                                     'fadglpsty') + '\n'
    assert expected == bot.output
예제 #31
0
def test_rss_global_update_update(bot_rss_update):
    rss._rss(bot_rss_update, ["update"])
    expected = "\x02[feed1]\x02 Title 1 \x02→\x02 http://www.site1.com/article1\n\x02[feed1]\x02 Title 2 \x02→\x02 http://www.site1.com/article2\n\x02[feed1]\x02 Title 3 \x02→\x02 http://www.site1.com/article3\n"
    assert expected == bot_rss_update.output
예제 #32
0
def test_rss_global_too_many_parameters(bot):
    rss._rss(bot, ["add", "#channel", "feedname", FEED_VALID, "f=fl+ftl", "fifth_argument"])
    expected = rss.COMMANDS["add"]["synopsis"].format(bot.config.core.prefix) + "\n"
    assert expected == bot.output