| 12345678910111213141516171819202122 |
- import auth_utils
- import db
- import requests
- import json
- try:
- # Get admin user
- res = db.execute_query("SELECT id, email, role FROM users WHERE email='admin@radionica3d.com'")
- if not res:
- with open("api_test_out.txt", "w") as f: f.write("Admin not found")
- exit()
- admin = res[0]
- token = auth_utils.create_access_token({"id": admin['id'], "role": admin['role'], "email": admin['email']})
- resp = requests.get("http://localhost:8000/orders/admin/list?lang=en", headers={"Authorization": f"Bearer {token}"})
-
- with open("api_test_out.txt", "w") as f:
- f.write(f"Status: {resp.status_code}\n")
- f.write(f"Body: {resp.text}\n")
- except Exception as e:
- with open("api_test_out.txt", "w") as f:
- f.write(f"Error: {str(e)}\n")
|