Exemplo n.º 1
0
def test_rss_templates_override(bot):
    format_add = 'f=l+agpt'
    templates_add = 't=t' + rss.TEMPLATE_SEPARATOR + 'addtitle:{}'
    templates_add += rss.CONFIG_SEPARATOR
    templates_add += 't=g' + rss.TEMPLATE_SEPARATOR + 'addguid:{}'
    options = templates_add + rss.CONFIG_SEPARATOR + format_add
    templates_feed = 't=t' + rss.TEMPLATE_SEPARATOR + 'feedtitle:{}'
    templates_feed += rss.CONFIG_SEPARATOR
    templates_feed += 't=a' + rss.TEMPLATE_SEPARATOR + 'feedauthor:{}'
    templates_default = 't=t' + rss.TEMPLATE_SEPARATOR + 'defaulttitle:{}'
    templates_default += rss.CONFIG_SEPARATOR
    templates_default += 't=p' + rss.TEMPLATE_SEPARATOR + 'defaultpublished:{}'
    templates_default += rss.CONFIG_SEPARATOR
    templates_default += 't=g' + rss.TEMPLATE_SEPARATOR + 'defaultguid:{}'
    rss._rss_add(bot, ['add', '#channel', 'feed', FEED_VALID, options])
    rss._rss_templates(bot, ['templates', 'feed', templates_feed])
    rss._rss_config(bot, ['config', 'templates', templates_default])
    bot.output = ''
    rss._rss_get(bot, ['get', 'feed'])
    expected = 'feedauthor:Author 1 addguid:1 at http://www.site1.com/ defaultpublished:2016-08-21 01:10 feedtitle:Title 1\nfeedauthor:Author 2 addguid:2 at http://www.site1.com/ defaultpublished:2016-08-22 02:20 feedtitle:Title 2\nfeedauthor:Author 3 addguid:3 at http://www.site1.com/ defaultpublished:2016-08-23 03:30 feedtitle:Title 3\n'
    assert expected == bot.output
Exemplo n.º 2
0
def test_rss_templates_override(bot):
    format_add = "f=l+agpt"
    templates_add = "t=t" + rss.TEMPLATE_SEPARATOR + "addtitle:{}"
    templates_add += rss.CONFIG_SEPARATOR
    templates_add += "t=g" + rss.TEMPLATE_SEPARATOR + "addguid:{}"
    options = templates_add + rss.CONFIG_SEPARATOR + format_add
    templates_feed = "t=t" + rss.TEMPLATE_SEPARATOR + "feedtitle:{}"
    templates_feed += rss.CONFIG_SEPARATOR
    templates_feed += "t=a" + rss.TEMPLATE_SEPARATOR + "feedauthor:{}"
    templates_default = "t=t" + rss.TEMPLATE_SEPARATOR + "defaulttitle:{}"
    templates_default += rss.CONFIG_SEPARATOR
    templates_default += "t=p" + rss.TEMPLATE_SEPARATOR + "defaultpublished:{}"
    templates_default += rss.CONFIG_SEPARATOR
    templates_default += "t=g" + rss.TEMPLATE_SEPARATOR + "defaultguid:{}"
    rss._rss_add(bot, ["add", "#channel", "feed", FEED_VALID, options])
    rss._rss_templates(bot, ["templates", "feed", templates_feed])
    rss._rss_config(bot, ["config", "templates", templates_default])
    bot.output = ""
    rss._rss_get(bot, ["get", "feed"])
    expected = "feedauthor:Author 1 addguid:1 at http://www.site1.com/ defaultpublished:2016-08-21 01:10 feedtitle:Title 1\nfeedauthor:Author 2 addguid:2 at http://www.site1.com/ defaultpublished:2016-08-22 02:20 feedtitle:Title 2\nfeedauthor:Author 3 addguid:3 at http://www.site1.com/ defaultpublished:2016-08-23 03:30 feedtitle:Title 3\n"
    assert expected == bot.output
Exemplo n.º 3
0
def test_rss_templates_changes_are_saved(bot):
    rss._rss_templates(bot, ["format", "feed1", "t=t|...{}..."])
    expected = ["#channel1;feed1;http://www.site1.com/feed;t=t|...{}..."]
    assert expected == bot.config.rss.feeds
Exemplo n.º 4
0
def test_rss_templates_set(bot):
    rss._rss_templates(bot, ["templates", "feed1", "t=f|%06%16[{}]%20"])
    expected = "t=f|%06%16[{}]%20\n\x0306\x02[feed1]\x0f Title \x02→\x02 https://github.com/RebelCodeBase/sopel-rss\n"
    assert expected == bot.output
Exemplo n.º 5
0
def test_rss_templates_get_default(bot):
    rss._rss_templates(bot, ["templates", "feed1"])
    assert "" == bot.output
Exemplo n.º 6
0
def test_rss_templates_changes_are_saved(bot):
    rss._rss_templates(bot, ['format', 'feed1', 't=t|...{}...'])
    expected = ['#channel1;feed1;http://www.site1.com/feed;t=t|...{}...']
    assert expected == bot.config.rss.feeds
Exemplo n.º 7
0
def test_rss_templates_set(bot):
    rss._rss_templates(bot, ['templates', 'feed1', 't=f|%06%16[{}]%20'])
    expected = 't=f|%06%16[{}]%20\n\x0306\x02[feed1]\x0f Title \x02→\x02 https://github.com/RebelCodeBase/sopel-rss\n'
    assert expected == bot.output
Exemplo n.º 8
0
def test_rss_templates_get_default(bot):
    rss._rss_templates(bot, ['templates', 'feed1'])
    assert '' == bot.output