def test_rss_formats_format_output(bot_rss_update): rss._rss_formats(bot_rss_update, ['format', 'feed1', 'f=fadglpst+fadglpst']) rss._rss_update(bot_rss_update, ['update']) expected = 'f=fadglpst+fadglpst' + ''' \x02[feed1]\x02 <Author 1> Description of article 1 1 at http://www.site1.com/ \x02→\x02 http://www.site1.com/article1 (2016-08-21 01:10) Description of article 1 Title 1 \x02[feed1]\x02 <Author 2> Description of article 2 2 at http://www.site1.com/ \x02→\x02 http://www.site1.com/article2 (2016-08-22 02:20) Description of article 2 Title 2 \x02[feed1]\x02 <Author 3> Description of article 3 3 at http://www.site1.com/ \x02→\x02 http://www.site1.com/article3 (2016-08-23 03:30) Description of article 3 Title 3 ''' assert expected == bot_rss_update.output
def test_rss_formats_format_output(bot_rss_update): rss._rss_formats(bot_rss_update, ["format", "feed1", "f=fadglpst+fadglpst"]) rss._rss_update(bot_rss_update, ["update"]) expected = ( "f=fadglpst+fadglpst" + """ \x02[feed1]\x02 <Author 1> Description of article 1 1 at http://www.site1.com/ \x02→\x02 http://www.site1.com/article1 (2016-08-21 01:10) Description of article 1 Title 1 \x02[feed1]\x02 <Author 2> Description of article 2 2 at http://www.site1.com/ \x02→\x02 http://www.site1.com/article2 (2016-08-22 02:20) Description of article 2 Title 2 \x02[feed1]\x02 <Author 3> Description of article 3 3 at http://www.site1.com/ \x02→\x02 http://www.site1.com/article3 (2016-08-23 03:30) Description of article 3 Title 3 """ ) assert expected == bot_rss_update.output
def test_rss_update_no_update(bot_rss_update): rss._rss_update(bot_rss_update, ["update"]) bot.output = "" rss._rss_update(bot_rss_update, ["update"]) assert "" == bot.output
def test_rss_update_update(bot_rss_update): rss._rss_update(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
def test_rss_update_no_update(bot_rss_update): rss._rss_update(bot_rss_update, ['update']) bot.output = '' rss._rss_update(bot_rss_update, ['update']) assert '' == bot.output
def test_rss_update_update(bot_rss_update): rss._rss_update(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