29 lines
703 B
Python
29 lines
703 B
Python
import os
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from src.main import app
|
|
|
|
|
|
@pytest.fixture
|
|
def client():
|
|
with TestClient(app) as test_client:
|
|
yield test_client
|
|
|
|
|
|
@pytest.fixture
|
|
def admin_password() -> str:
|
|
# Пароль админа берём из окружения, чтобы не хардкодить локальные отличия.
|
|
return os.getenv("OPENBAO__TEST_ADMIN_PASSWORD", "admin123")
|
|
|
|
|
|
@pytest.fixture
|
|
def admin_tokens(client, admin_password: str):
|
|
response = client.post(
|
|
"/api/v1/auth/login",
|
|
json={"username": "admin", "password": admin_password},
|
|
)
|
|
assert response.status_code == 200
|
|
return response.json()
|