DFiP_Budget_planing/api/tests/integration/test_auth_api_smoke.py
2026-05-05 18:07:16 +03:00

28 lines
770 B
Python

def test_login_success(client):
response = client.post(
"/api/v1/auth/login",
json={"username": "admin", "password": "admin"},
)
assert response.status_code == 200
data = response.json()
assert "access_token" in data
assert "refresh_token" in data
def test_login_invalid_password(client):
response = client.post(
"/api/v1/auth/login",
json={"username": "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