示例#1
0
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
示例#2
0
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"]
示例#3
0
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
示例#4
0
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
示例#5
0
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
示例#6
0
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
示例#7
0
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
示例#8
0
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
示例#9
0
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
示例#10
0
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']
示例#11
0
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']
示例#12
0
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
示例#13
0
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
示例#14
0
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
示例#15
0
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"]
示例#16
0
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
示例#17
0
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
示例#18
0
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