22 lines
563 B
Python
22 lines
563 B
Python
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from src.main import app
|
|
|
|
|
|
@pytest.fixture
|
|
def client():
|
|
# Используем настройки и DATABASE_URL из окружения так же, как это делает приложение.
|
|
with TestClient(app) as test_client:
|
|
yield test_client
|
|
|
|
|
|
@pytest.fixture
|
|
def admin_tokens(client):
|
|
response = client.post(
|
|
"/api/v1/auth/login",
|
|
json={"username": "admin", "password": "admin123"},
|
|
)
|
|
assert response.status_code == 200
|
|
return response.json()
|