first prototype commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
from backend.main import app
|
||||
|
||||
def test_root_endpoint():
|
||||
with TestClient(app) as client:
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "running"
|
||||
|
||||
def test_demo_login():
|
||||
with TestClient(app) as client:
|
||||
response = client.post("/api/auth/demo-login", json={"email": "admin@choreus.app"})
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "access_token" in data
|
||||
assert data["user"]["email"] == "admin@choreus.app"
|
||||
assert data["user"]["role"] == "admin"
|
||||
|
||||
def test_google_auth_mock():
|
||||
with TestClient(app) as client:
|
||||
response = client.post("/api/auth/google", json={
|
||||
"credential": "mock_token",
|
||||
"email": "newuser@choreus.app",
|
||||
"name": "New User",
|
||||
"avatar_url": "https://api.dicebear.com/7.x/bottts/svg?seed=NewUser"
|
||||
})
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["user"]["email"] == "newuser@choreus.app"
|
||||
assert data["user"]["role"] == "regular"
|
||||
Reference in New Issue
Block a user