Пример #1
0
def test_message_blacklist(setup_database):
    login = database.upsert_login(12345, 7)
    blacklist = database.upsert_message_blacklist(12345, [7])
    reloaded_blacklists = database.get_all_message_blacklist()
    assert len(reloaded_blacklists) == 1

    assert reloaded_blacklists[0].login_id == blacklist.login_id
    assert reloaded_blacklists[0].blacklist == blacklist.blacklist
Пример #2
0
def test_message_blacklist(setup_database):
    login = database.upsert_login(12345, 7)
    blacklist = database.upsert_message_blacklist(12345, [7])
    reloaded_blacklists = database.get_all_message_blacklist()
    assert len(reloaded_blacklists) == 1

    assert reloaded_blacklists[0].login_id == blacklist.login_id
    assert reloaded_blacklists[0].blacklist == blacklist.blacklist
Пример #3
0
def init():
    database.init_db()

    current_revision = database.get_current_revision()
    head_revision = database.get_head_revision()
    if head_revision != current_revision:
        print("Database is not up to date! "
              "To upgrade database run pushkin --configuration {cfg} --upgrade-db".format(cfg=CONFIGURATION_FILENAME))
        sys.exit(1)

    context.log_queue = multiprocessing.Queue()
    context.request_processor = RequestProcessor()
    context.event_handler_manager = EventHandlerManager()
    context.message_blacklist = {row.login_id:set(row.blacklist) for row in database.get_all_message_blacklist()}
Пример #4
0
def init():
    database.init_db()

    current_revision = database.get_current_revision()
    head_revision = database.get_head_revision()
    if head_revision != current_revision:
        print(
            "Database is not up to date! "
            "To upgrade database run pushkin --configuration {cfg} --upgrade-db"
            .format(cfg=CONFIGURATION_FILENAME))
        sys.exit(1)

    context.log_queue = multiprocessing.Queue()
    context.request_processor = RequestProcessor()
    context.event_handler_manager = EventHandlerManager()
    context.message_blacklist = {
        row.login_id: set(row.blacklist)
        for row in database.get_all_message_blacklist()
    }