예제 #1
0
파일: base.py 프로젝트: gisho/sync-engine
def empty_db(config):
    from inbox.ignition import engine_manager
    from inbox.models.session import new_session
    setup_test_db()
    engine = engine_manager.get_for_id(0)
    engine.session = new_session(engine)
    yield engine
    engine.session.close()
예제 #2
0
def empty_db(config):
    from inbox.ignition import engine_manager
    from inbox.models.session import new_session
    setup_test_db()
    engine = engine_manager.get_for_id(0)
    engine.session = new_session(engine)
    yield engine
    engine.session.close()
예제 #3
0
파일: base.py 프로젝트: gisho/sync-engine
def db(dbloader):
    from inbox.ignition import engine_manager
    from inbox.models.session import new_session
    engine = engine_manager.get_for_id(0)
    # TODO(emfree): tests should really either instantiate their own sessions,
    # or take a fixture that is itself a session.
    engine.session = new_session(engine)
    yield engine
    engine.session.close()
예제 #4
0
def real_db():
    """A fixture to get access to the real mysql db. We need this
    to log in to providers like gmail to check that events changes
    are synced back."""
    engine = main_engine()
    session = new_session(engine)
    yield session
    session.rollback()
    session.close()
예제 #5
0
def db(dbloader):
    from inbox.ignition import engine_manager
    from inbox.models.session import new_session
    engine = engine_manager.get_for_id(0)
    # TODO(emfree): tests should really either instantiate their own sessions,
    # or take a fixture that is itself a session.
    engine.session = new_session(engine)
    yield engine
    engine.session.close()
예제 #6
0
def real_db():
    """A fixture to get access to the real mysql db. We need this
    to log in to providers like gmail to check that events changes
    are synced back."""
    engine = main_engine()
    session = new_session(engine)
    yield session
    session.rollback()
    session.close()
예제 #7
0
def start():
    g.db_session = new_session(engine)
    g.log = get_logger()

    try:
        watch_state = request.headers[GOOGLE_RESOURCE_STATE_STRING]
        g.watch_channel_id = request.headers[GOOGLE_CHANNEL_ID_STRING]
        g.watch_resource_id = request.headers[GOOGLE_RESOURCE_ID_STRING]
    except KeyError:
        raise InputError('Malformed headers')

    if watch_state == 'sync':
        return resp(204)
예제 #8
0
def start():
    g.db_session = new_session(engine)
    g.log = get_logger()

    try:
        watch_state = request.headers[GOOGLE_RESOURCE_STATE_STRING]
        g.watch_channel_id = request.headers[GOOGLE_CHANNEL_ID_STRING]
        g.watch_resource_id = request.headers[GOOGLE_RESOURCE_ID_STRING]
    except KeyError:
        raise InputError('Malformed headers')

    if watch_state == 'sync':
        return resp(204)
예제 #9
0
def empty_db(request, config):
    from inbox.models.session import new_session
    testdb = TestDB()
    testdb.session = new_session(testdb.engine)
    yield testdb
    testdb.session.close()
예제 #10
0
def db(dbloader):
    from inbox.models.session import new_session
    dbloader.session = new_session(dbloader.engine)
    yield dbloader
    dbloader.session.close()
예제 #11
0
def db(dbloader):
    from inbox.models.session import new_session
    dbloader.session = new_session(dbloader.engine)
    yield dbloader
    dbloader.session.close()
예제 #12
0
파일: base.py 프로젝트: rf-/sync-engine
def empty_db(request, config):
    from inbox.models.session import new_session
    testdb = TestDB()
    testdb.session = new_session(testdb.engine)
    yield testdb
    testdb.session.close()