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()
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()
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()
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)
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()
def db(dbloader): from inbox.models.session import new_session dbloader.session = new_session(dbloader.engine) yield dbloader dbloader.session.close()