Add test database configuration and schema creation for testing

This commit is contained in:
grillazz
2025-12-25 15:56:23 +01:00
parent f90513aab4
commit 5d34b04ca1
9 changed files with 96 additions and 17 deletions

View File

@@ -33,6 +33,8 @@ class Settings(BaseSettings):
POSTGRES_PASSWORD: str
POSTGRES_HOST: str
POSTGRES_DB: str
POSTGRES_TEST_USER: str
POSTGRES_TEST_DB: str
@computed_field
@property
@@ -80,6 +82,17 @@ class Settings(BaseSettings):
path=self.POSTGRES_DB,
)
@computed_field
@property
def test_asyncpg_url(self) -> PostgresDsn:
return MultiHostUrl.build(
scheme="postgresql+asyncpg",
username=self.POSTGRES_USER,
password=self.POSTGRES_PASSWORD,
host=self.POSTGRES_HOST,
path=self.POSTGRES_TEST_DB,
)
@computed_field
@property
def postgres_url(self) -> PostgresDsn: