feat: add SQLiteUserRepository with tests
This commit is contained in:
parent
6c4ba79eed
commit
d941209f1e
3 changed files with 356 additions and 0 deletions
20
tests/test_store/conftest.py
Normal file
20
tests/test_store/conftest.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from pathlib import Path
|
||||
|
||||
import aiosqlite
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.store.sqlite.migrations import run_migrations
|
||||
|
||||
MIGRATIONS_DIR = (
|
||||
Path(__file__).resolve().parent.parent.parent / "src" / "fastapi_oidc_op" / "store" / "sqlite" / "migrations"
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def db():
|
||||
conn = await aiosqlite.connect(":memory:")
|
||||
conn.row_factory = aiosqlite.Row
|
||||
await conn.execute("PRAGMA foreign_keys=ON")
|
||||
await run_migrations(conn, MIGRATIONS_DIR)
|
||||
yield conn
|
||||
await conn.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue