Init Repo
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
"""
|
||||
Debug script to test tasks endpoint with admin/coordinator user
|
||||
"""
|
||||
import requests
|
||||
|
||||
BASE_URL = "http://localhost:8000"
|
||||
SHOT_ID = 1
|
||||
|
||||
# Login
|
||||
login_response = requests.post(
|
||||
f"{BASE_URL}/auth/login",
|
||||
json={"email": "admin@vfx.com", "password": "admin123"}
|
||||
)
|
||||
|
||||
if login_response.status_code == 200:
|
||||
token = login_response.json()["access_token"]
|
||||
print(f"✓ Logged in successfully")
|
||||
|
||||
# Get user info
|
||||
headers = {"Authorization": f"Bearer {token}"}
|
||||
me_response = requests.get(f"{BASE_URL}/users/me", headers=headers)
|
||||
if me_response.status_code == 200:
|
||||
user = me_response.json()
|
||||
print(f"User: {user['email']}")
|
||||
print(f"Role: {user['role']}")
|
||||
print(f"Is Admin: {user['is_admin']}")
|
||||
|
||||
# Try without trailing slash
|
||||
print(f"\n--- Testing GET /tasks?shot_id={SHOT_ID} (no trailing slash) ---")
|
||||
response1 = requests.get(
|
||||
f"{BASE_URL}/tasks",
|
||||
params={"shot_id": SHOT_ID},
|
||||
headers=headers,
|
||||
allow_redirects=False # Don't follow redirects
|
||||
)
|
||||
print(f"Status: {response1.status_code}")
|
||||
print(f"Headers: {dict(response1.headers)}")
|
||||
if response1.status_code in [301, 302, 307, 308]:
|
||||
print(f"Redirect to: {response1.headers.get('location')}")
|
||||
|
||||
# Try with trailing slash
|
||||
print(f"\n--- Testing GET /tasks/?shot_id={SHOT_ID} (with trailing slash) ---")
|
||||
response2 = requests.get(
|
||||
f"{BASE_URL}/tasks/",
|
||||
params={"shot_id": SHOT_ID},
|
||||
headers=headers
|
||||
)
|
||||
print(f"Status: {response2.status_code}")
|
||||
if response2.status_code == 200:
|
||||
tasks = response2.json()
|
||||
print(f"✓ Found {len(tasks)} tasks")
|
||||
else:
|
||||
print(f"Response: {response2.text[:500]}")
|
||||
else:
|
||||
print(f"✗ Login failed: {login_response.status_code}")
|
||||
print(login_response.text)
|
||||
Reference in New Issue
Block a user