def test_feed_add_create_feed(bot): rss._feed_add(bot, '#channel', 'feedname', FEED_VALID) feed = bot.memory['rss']['feeds']['feedname'] assert { 'name': 'feedname', 'url': FEED_VALID, 'channel': '#channel' } == feed
def test_feed_delete_delete_ring_buffer(bot): rss._feed_add(bot, "#channel", "feedname", FEED_VALID) rss._feed_delete(bot, "feedname") assert "feedname" not in bot.memory["rss"]["hashes"]
def test_feed_delete_delete_db_table(bot): rss._feed_add(bot, "#channel", "feedname", FEED_VALID) rss._feed_delete(bot, "feedname") result = rss._db_check_if_table_exists(bot, "feedname") assert [] == result
def test_feed_add_create_feed(bot): rss._feed_add(bot, "#channel", "feedname", FEED_VALID) feed = bot.memory["rss"]["feeds"]["feedname"] assert {"name": "feedname", "url": FEED_VALID, "channel": "#channel"} == feed
def test_feed_add_create_ring_buffer(bot): rss._feed_add(bot, "#channel", "feedname", FEED_VALID) assert type(bot.memory["rss"]["hashes"]["feedname"]) == rss.RingBuffer
def test_feed_add_create_db_table(bot): rss._feed_add(bot, "#channel", "feedname", FEED_VALID) result = rss._db_check_if_table_exists(bot, "feedname") assert [(rss._digest_tablename("feedname"),)] == result
def test_rss_get_feed_spy(bot): rss._feed_add(bot, "#channel", "SPY", FEED_SPY) rss._rss_get(bot, ["get", "SPY"]) expected = "\x02[SPY]\x02 Deutsche Bank Predicts 10% Pullback in S&P 500 \x02→\x02 http://markets.financialcontent.com/stocks/news/read?GUID=32821698&Symbol=SPY\n" assert expected == bot.output
def test_rss_get_feed_spy(bot): rss._feed_add(bot, '#channel', 'SPY', FEED_SPY) rss._rss_get(bot, ['get', 'SPY']) expected = '\x02[SPY]\x02 Deutsche Bank Predicts 10% Pullback in S&P 500 \x02→\x02 http://markets.financialcontent.com/stocks/news/read?GUID=32821698&Symbol=SPY\n' assert expected == bot.output
def test_feed_list_format(bot): rss._feed_add(bot, 'channel', 'feed', FEED_VALID, 'f=ft+ftldsapg') rss._feed_list(bot, 'feed') expected = 'channel feed ' + FEED_VALID + ' f=ft+ftldsapg\n' assert expected == bot.output
def test_feed_delete_delete_feed(bot): rss._feed_add(bot, 'channel', 'feed', FEED_VALID) rss._feed_delete(bot, 'feed') assert 'feed' not in bot.memory['rss']['feeds']
def test_feed_delete_delete_ring_buffer(bot): rss._feed_add(bot, '#channel', 'feedname', FEED_VALID) rss._feed_delete(bot, 'feedname') assert 'feedname' not in bot.memory['rss']['hashes']
def test_feed_delete_delete_db_table(bot): rss._feed_add(bot, '#channel', 'feedname', FEED_VALID) rss._feed_delete(bot, 'feedname') result = rss._db_check_if_table_exists(bot, 'feedname') assert [] == result
def test_feed_add_create_ring_buffer(bot): rss._feed_add(bot, '#channel', 'feedname', FEED_VALID) assert type(bot.memory['rss']['hashes']['feedname']) == rss.RingBuffer
def test_feed_add_create_db_table(bot): rss._feed_add(bot, '#channel', 'feedname', FEED_VALID) result = rss._db_check_if_table_exists(bot, 'feedname') assert [(rss._digest_tablename('feedname'), )] == result
def test_feed_delete_delete_feed(bot): rss._feed_add(bot, "channel", "feed", FEED_VALID) rss._feed_delete(bot, "feed") assert "feed" not in bot.memory["rss"]["feeds"]
def test_rss_get_post_feed_items(bot): rss._feed_add(bot, "#channel", "feedname", FEED_VALID) rss._rss_get(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
def test_feed_list_format(bot): rss._feed_add(bot, "channel", "feed", FEED_VALID, "f=ft+ftldsapg") rss._feed_list(bot, "feed") expected = "channel feed " + FEED_VALID + " f=ft+ftldsapg\n" assert expected == bot.output
def test_rss_get_post_feed_items(bot): rss._feed_add(bot, '#channel', 'feedname', FEED_VALID) rss._rss_get(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