Files
uis-cloud-computing/7project/backend/tests/test_e2e_auth_flow.py
ribardej e78b8c2e6b
Some checks failed
Run Python Tests / build-and-test (push) Has been cancelled
fix(tests): fixed a service test and one warning regarding 422 status
2025-10-22 14:53:45 +02:00

16 lines
585 B
Python

from fastapi import status
def test_e2e_minimal_auth_flow(client):
# 1) Service is alive
alive = client.get("/")
assert alive.status_code == status.HTTP_200_OK
# 2) Attempt to login without payload should fail fast (validation error)
login = client.post("/auth/jwt/login")
assert login.status_code in (status.HTTP_400_BAD_REQUEST, status.HTTP_422_UNPROCESSABLE_CONTENT)
# 3) Protected endpoint should not be accessible without token
me = client.get("/users/me")
assert me.status_code in (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN)