def setup_pg_catalog(request): conf = postgres_conf.format( host=request.config.getoption("--pg-host"), secret=settings.DEFAULT_CATALOG_SECRET, ) with closing(catalog_connection_yaml(conf)) as root_connection: with root_connection.engine.connect() as conn: conn.execute( "CREATE USER catalog_user PASSWORD 'catal0g_passw0rd'") conn.execution_options( isolation_level="AUTOCOMMIT").execute("CREATE DATABASE tokern") conn.execution_options(isolation_level="AUTOCOMMIT").execute( "GRANT ALL PRIVILEGES ON DATABASE tokern TO catalog_user") yield pg_catalog_conf.format( host=request.config.getoption("--pg-host"), secret=settings.DEFAULT_CATALOG_SECRET, ) with root_connection.engine.connect() as conn: conn.execution_options( isolation_level="AUTOCOMMIT").execute("DROP DATABASE tokern") conn.execution_options( isolation_level="AUTOCOMMIT").execute("DROP USER catalog_user")
def root_connection(request): conf = postgres_conf.format( host=request.config.getoption("--pg-host"), secret=settings.DEFAULT_CATALOG_SECRET, ) with closing(catalog_connection_yaml(conf)) as conn: yield conn
def root_connection(request): conf = postgres_conf.format(host=request.config.getoption("--pg-host")) with closing(catalog_connection_yaml(conf)) as conn: yield conn
def open_catalog_connection( catalog_conf) -> Generator[Tuple[Catalog, str], None, None]: with closing(catalog_connection_yaml(catalog_conf)) as conn: init_db(conn) yield conn, catalog_conf