66 lines
2.3 KiB
Python
66 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Final test for asset custom status support
|
|
"""
|
|
|
|
import requests
|
|
|
|
BASE_URL = 'http://localhost:8000'
|
|
|
|
def login():
|
|
"""Login and get access token"""
|
|
response = requests.post(f'{BASE_URL}/auth/login', json={'email': 'admin@vfx.com', 'password': 'admin123'})
|
|
if response.status_code != 200:
|
|
print("❌ Login failed")
|
|
return None
|
|
return response.json()['access_token']
|
|
|
|
def test_asset_optimization():
|
|
token = login()
|
|
if not token:
|
|
return
|
|
|
|
headers = {'Authorization': f'Bearer {token}'}
|
|
|
|
# Get assets with optimized query
|
|
response = requests.get(f'{BASE_URL}/assets/?project_id=10', headers=headers)
|
|
print(f"Get assets - Status: {response.status_code}")
|
|
|
|
if response.status_code == 200:
|
|
assets = response.json()
|
|
print(f"Found {len(assets)} assets")
|
|
|
|
if assets:
|
|
asset = assets[0]
|
|
task_status = asset.get('task_status', {})
|
|
task_details = asset.get('task_details', [])
|
|
|
|
print(f"Asset: {asset['name']}")
|
|
print(f"Task status: {task_status}")
|
|
print(f"Task details count: {len(task_details)}")
|
|
|
|
# Check for custom statuses
|
|
custom_status_found = False
|
|
for task_type, status in task_status.items():
|
|
if status not in ['not_started', 'in_progress', 'submitted', 'approved', 'retake']:
|
|
custom_status_found = True
|
|
print(f"✅ Found custom status in task_status: {task_type} = {status}")
|
|
|
|
# Check task details
|
|
for task_detail in task_details:
|
|
status = task_detail.get('status')
|
|
if status not in ['not_started', 'in_progress', 'submitted', 'approved', 'retake']:
|
|
custom_status_found = True
|
|
print(f"✅ Found custom status in task_details: {task_detail['task_type']} = {status}")
|
|
|
|
if custom_status_found:
|
|
print("🎉 Asset optimization with custom statuses: PASSED")
|
|
else:
|
|
print("❌ No custom statuses found in asset optimization")
|
|
else:
|
|
print("No assets found")
|
|
else:
|
|
print(f"Failed to get assets: {response.text}")
|
|
|
|
if __name__ == "__main__":
|
|
test_asset_optimization() |