minhtrannhat 49c83fa287
feat(api+testing): select member by email
- Reorganized folder structure so routes live in the same folder
- Set up pytest fixtures for future use
2024-03-01 20:14:20 -05:00

29 lines
522 B
Python

import os
import pytest
from fastapi.testclient import TestClient
from psycopg_pool import AsyncConnectionPool
from src.neo_neo_todo.main import app
@pytest.fixture
async def client():
yield TestClient(app)
@pytest.fixture
async def db_pool():
try:
postgres_db_url = os.environ["TODO_DB_DATABASE_URL"]
except KeyError:
raise KeyError("Can't find postgres DB URL")
pool = AsyncConnectionPool(postgres_db_url, open=False)
await pool.open()
yield pool
await pool.close()