Пример #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