mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 06:57:47 +01:00
feat(tests): Implemented basic tests and github workflow
This commit is contained in:
15
7project/backend/tests/test_e2e_auth_flow.py
Normal file
15
7project/backend/tests/test_e2e_auth_flow.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user