mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
16 lines
584 B
Python
16 lines
584 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_ENTITY)
|
|
|
|
# 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)
|