Checkpoint React frontend migration
This commit is contained in:
19
test_api.py
Normal file
19
test_api.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import asyncio
|
||||
import httpx
|
||||
import json
|
||||
|
||||
async def run():
|
||||
async with httpx.AsyncClient() as client:
|
||||
# 1. Login
|
||||
resp = await client.post("http://localhost:8000/api/v1/auth/admin-login", json={"username": "admin", "password": "admin123"})
|
||||
print("Login resp:", resp.json())
|
||||
token = resp.json().get("access_token")
|
||||
|
||||
# 2. Fetch questions
|
||||
resp2 = await client.get(
|
||||
"http://localhost:8000/api/v1/admin/tryouts/132380/questions",
|
||||
headers={"Authorization": f"Bearer {token}", "X-Website-ID": "1"}
|
||||
)
|
||||
print("Questions resp:", json.dumps(resp2.json(), indent=2))
|
||||
|
||||
asyncio.run(run())
|
||||
Reference in New Issue
Block a user