Beispiel #1
0
def _fixture_bot_add_data(bot, id, url):
    bot.memory["rss"]["feeds"]["feed" + id] = {"channel": "#channel" + id, "name": "feed" + id, "url": url}
    bot.memory["rss"]["hashes"]["feed" + id] = rss.RingBuffer(100)
    feedreader = rss.MockFeedReader(FEED_VALID)
    bot.memory["rss"]["options"]["feed" + id] = rss.Options(bot, feedreader)
    sql_create_table = (
        "CREATE TABLE " + rss._digest_tablename("feed" + id) + " (id INTEGER PRIMARY KEY, hash VARCHAR(32) UNIQUE)"
    )
    bot.db.execute(sql_create_table)
    bot.config.core.channels = ["#channel" + id]
    return bot
Beispiel #2
0
def _fixture_bot_add_data(bot, id, url):
    bot.memory['rss']['feeds']['feed' + id] = {
        'channel': '#channel' + id,
        'name': 'feed' + id,
        'url': url
    }
    bot.memory['rss']['hashes']['feed' + id] = rss.RingBuffer(100)
    feedreader = rss.MockFeedReader(FEED_VALID)
    bot.memory['rss']['options']['feed' + id] = rss.Options(bot, feedreader)
    sql_create_table = 'CREATE TABLE ' + rss._digest_tablename(
        'feed' + id) + ' (id INTEGER PRIMARY KEY, hash VARCHAR(32) UNIQUE)'
    bot.db.execute(sql_create_table)
    bot.config.core.channels = ['#channel' + id]
    return bot
Beispiel #3
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
Beispiel #4
0
def test_digest_tablename_works():
    digest = rss._digest_tablename("thisisatest")
    assert "rss_f830f69d23b8224b512a0dc2f5aec974" == digest
Beispiel #5
0
def test_db_create_table_and_db_check_if_table_exists(bot):
    rss._db_create_table(bot, "feedname")
    result = rss._db_check_if_table_exists(bot, "feedname")
    assert [(rss._digest_tablename("feedname"),)] == result
Beispiel #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
Beispiel #7
0
def test_digest_tablename_works():
    digest = rss._digest_tablename('thisisatest')
    assert 'rss_f830f69d23b8224b512a0dc2f5aec974' == digest
Beispiel #8
0
def test_db_create_table_and_db_check_if_table_exists(bot):
    rss._db_create_table(bot, 'feedname')
    result = rss._db_check_if_table_exists(bot, 'feedname')
    assert [(rss._digest_tablename('feedname'), )] == result