DFiP_Budget_planing/api/tests/integration/test_auth_api_smoke.py
2026-05-13 12:28:00 +03:00

28 lines
827 B
Python

def test_login_success(client, admin_password):
response = client.post(
"/api/v1/auth/login",
json={"username": "admin", "password": admin_password},
)
assert response.status_code == 200
data = response.json()
assert "access_token" in data
assert "refresh_token" in data
def test_login_invalid_password(client, admin_password):
response = client.post(
"/api/v1/auth/login",
json={"username": "admin", "password": f"{admin_password}_wrong"},
)
assert response.status_code == 401
def test_refresh_success(client, admin_tokens):
response = client.post(
"/api/v1/auth/refresh",
json={"refresh_token": admin_tokens["refresh_token"]},
)
assert response.status_code == 200
data = response.json()
assert "access_token" in data