step 2 with basic crud implemented
This commit is contained in:
+11
-1
@@ -2,8 +2,9 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.db import configure_database
|
||||
from app.db import SessionLocal, configure_database
|
||||
from app.main import create_app
|
||||
|
||||
|
||||
@@ -17,3 +18,12 @@ def client(tmp_path: Path):
|
||||
|
||||
with TestClient(app) as test_client:
|
||||
yield test_client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def db_session(client) -> Session:
|
||||
db = SessionLocal()
|
||||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
Reference in New Issue
Block a user