add tests for project #1
3
pytest.ini
Normal file
3
pytest.ini
Normal file
@@ -0,0 +1,3 @@
|
||||
[pytest]
|
||||
pythonpath = . src
|
||||
asyncio_mode = auto
|
||||
@@ -34,7 +34,7 @@ class AccessToken(BaseSettings):
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env", env_file_encoding="utf-8", env_prefix="ACCESS_TOKEN_"
|
||||
)
|
||||
expire_minutes: int = 15
|
||||
expire_minutes: int
|
||||
secret_key: str
|
||||
algorithm: str = "HS256"
|
||||
token_type: str = "bearer" # noqa: S105
|
||||
@@ -43,7 +43,7 @@ class AccessToken(BaseSettings):
|
||||
class Settings(BaseSettings):
|
||||
api: ApiPrefix = ApiPrefix()
|
||||
db: DbSettings = DbSettings()
|
||||
access_token: AccessToken = AccessToken()
|
||||
access_token: AccessToken = AccessToken() # type: ignore
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
15
tests/conftest.py
Normal file
15
tests/conftest.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
from sqlalchemy import NullPool
|
||||
from sqlalchemy.ext.asyncio import create_async_engine
|
||||
|
||||
from src.core.database import Base
|
||||
from src.models import * # noqa: F403
|
||||
|
||||
engine_null_pool = create_async_engine('sqlite+aiosqlite:///tests/test_db.db', poolclass=NullPool)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
async def setup_database():
|
||||
async with engine_null_pool.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.drop_all)
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
0
tests/integration_tests/__init__.py
Normal file
0
tests/integration_tests/__init__.py
Normal file
0
tests/unit_tests/__init__.py
Normal file
0
tests/unit_tests/__init__.py
Normal file
Reference in New Issue
Block a user