mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 23:55:46 +02:00
Set up mongo connection in pytest & fix authentication url
This commit is contained in:
parent
52b452c85a
commit
6bebd109bb
2 changed files with 17 additions and 4 deletions
|
|
@ -7,14 +7,14 @@ from sqlalchemy.orm import sessionmaker
|
|||
|
||||
import settings
|
||||
|
||||
encoded_password = quote_plus(settings.POSTGRES_PASS)
|
||||
encoded_postgres_password = quote_plus(settings.POSTGRES_PASS)
|
||||
|
||||
# PostgreSQL engine
|
||||
postgres_engine = create_async_engine(
|
||||
URL.create(
|
||||
drivername="postgresql+asyncpg",
|
||||
username=settings.POSTGRES_USER,
|
||||
password=encoded_password,
|
||||
password=encoded_postgres_password,
|
||||
host=settings.POSTGRES_HOST,
|
||||
port=settings.POSTGRES_PORT,
|
||||
database=settings.POSTGRES_DB,
|
||||
|
|
@ -28,4 +28,7 @@ DBSession = sessionmaker(
|
|||
)
|
||||
|
||||
# MongoDB client
|
||||
mongo_client = motor.motor_asyncio.AsyncIOMotorClient(settings.MONGO_HOST, settings.MONGO_PORT)
|
||||
encoded_mongo_username = quote_plus(settings.MONGO_USER)
|
||||
encoded_mongo_password = quote_plus(settings.MONGO_PASS)
|
||||
mongo_url = f"mongodb://{encoded_mongo_username}:{encoded_mongo_password}@{settings.MONGO_HOST}:{settings.MONGO_PORT}/"
|
||||
mongo_client = motor.motor_asyncio.AsyncIOMotorClient(mongo_url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue