def test_rss_config_formats_output(bot): rss._rss_config(bot, ["config", "formats", "f=t+t"]) rss._rss_add(bot, ["add", "#channel", "feedname", FEED_VALID]) bot.output = "" rss._rss_get(bot, ["get", "feedname"]) expected = "Title 1\nTitle 2\nTitle 3\n" assert expected == bot.output
def test_rss_config_formats_output(bot): rss._rss_config(bot, ['config', 'formats', 'f=t+t']) rss._rss_add(bot, ['add', '#channel', 'feedname', FEED_VALID]) bot.output = '' rss._rss_get(bot, ['get', 'feedname']) expected = 'Title 1\nTitle 2\nTitle 3\n' assert expected == bot.output
def test_rss_config_feeds_list(bot): rss._rss_add(bot, ['add', '#channel2', 'feed2', FEED_VALID, 'f=p+tlpas']) rss._rss_formats(bot, ['format', 'feed1', 'f=asl+als']) 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=asl+als,#channel2' + rss.CONFIG_SEPARATOR + 'feed2' + rss.CONFIG_SEPARATOR + FEED_VALID + rss.CONFIG_SEPARATOR + 'f=p+tlpas\n' assert expected == bot.output
def test_rss_fields_get_custom(bot): rss._rss_add(bot, ['add', '#channel', 'feedname', FEED_VALID, 'f=fltp+atl']) bot.output = '' rss._rss_fields(bot, ['fields', 'feedname']) expected = rss.MESSAGES['fields_of_feed'].format('feedname', 'fadglpsty') + '\n' assert expected == bot.output
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
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
def test_rss_config_feeds_list(bot): rss._rss_add(bot, ["add", "#channel2", "feed2", FEED_VALID, "f=p+tlpas"]) rss._rss_formats(bot, ["format", "feed1", "f=asl+als"]) 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=asl+als,#channel2" + rss.CONFIG_SEPARATOR + "feed2" + rss.CONFIG_SEPARATOR + FEED_VALID + rss.CONFIG_SEPARATOR + "f=p+tlpas\n" ) assert expected == bot.output
def test_rss_add_feed_add(bot): rss._rss_add(bot, ["add", "#channel", "feedname", FEED_VALID]) assert rss._feed_exists(bot, "feedname") == True
def test_rss_fields_get_custom(bot): rss._rss_add(bot, ["add", "#channel", "feedname", FEED_VALID, "f=fltp+atl"]) bot.output = "" rss._rss_fields(bot, ["fields", "feedname"]) expected = rss.MESSAGES["fields_of_feed"].format("feedname", "fadglpsty") + "\n" assert expected == bot.output
def test_rss_del_feed_delete(bot): rss._rss_add(bot, ["add", "#channel", "feedname", FEED_VALID]) rss._rss_del(bot, ["del", "feedname"]) assert rss._feed_exists(bot, "feedname") == False
def test_rss_del_feed_delete(bot): rss._rss_add(bot, ['add', '#channel', 'feedname', FEED_VALID]) rss._rss_del(bot, ['del', 'feedname']) assert rss._feed_exists(bot, 'feedname') == False
def test_rss_add_feed_add(bot): rss._rss_add(bot, ['add', '#channel', 'feedname', FEED_VALID]) assert rss._feed_exists(bot, 'feedname') == True