def db(): config = get_config(['-c', TEST_CONFIG_PATH.as_posix()]) cb_conf = config['couchbase'] setup_db(cb_conf) yield teardown_db(cb_conf)
def lambda_handler(aws_event, aws_context): """ AWS Lambda entry point. This is a cloudformation CustomResource that Sets up the hyp3 database for the hyp3 system to use. :param aws_event: lambda event data :param aws_context: lambda runtime info """ setup_db(aws_event, get_db_creds(), get_db_low_priv_creds())
def setup_app() -> web.Application: loop = asyncio.get_event_loop() app = web.Application(router=routing.ResourceRouter()) db = loop.run_until_complete(setup_db()) app['db'] = db app['config'] = config setup_routes(app.router) setup_middlewares(app.middlewares) return app
def test_setup_db(dbmock, environ_mock, event, environment): reset_hyp3_db() environ_mock.__getitem__.side_effect = environment.__getitem__ environ_mock.get.side_effect = environment.get # Creds only need db name because call to # connect() is mocked with test_db() setup_db( event, [TESTING_DB], [TESTING_DB] ) with hyp3_db.test_db(db=TESTING_DB) as db: check_new_user(db, environment) check_processes(db, environment) check_setup_db_still_works(event)
def db(): test_config = get_config(['-c', TEST_CONFIG_PATH.as_posix()]) setup_db(test_config['postgres']) yield teardown_db(test_config['postgres'])
def db(): setup_db(TEST_CONFIG['postgres']) yield teardown_db(TEST_CONFIG['postgres'])
def db(): test_config = get_config(TEST_CONFIG) setup_db(test_config['mysql']) yield teardown_db(test_config['mysql'])
def db(): test_config = get_config(TEST_CONFIG_PATH) setup_db(test_config['postgres']) yield teardown_db(test_config['postgres'])
def db(): test_config = get_config() setup_db(test_config['postgres']) yield teardown_db(test_config['postgres'])
def db(): test_config = get_config(["-c", TEST_CONFIG_PATH.as_posix()]) setup_db(test_config["postgres"]) yield teardown_db(test_config["postgres"])
def check_setup_db_still_works(sample_event): setup_db(sample_event, [TESTING_DB], [TESTING_DB])