Init Repo
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
"""
|
||||
Test script for bulk shot creation
|
||||
"""
|
||||
import requests
|
||||
import json
|
||||
|
||||
BASE_URL = "http://localhost:8000"
|
||||
|
||||
# Test credentials
|
||||
LOGIN_DATA = {
|
||||
"email": "admin@vfx.com",
|
||||
"password": "admin123"
|
||||
}
|
||||
|
||||
|
||||
def login():
|
||||
"""Login and get access token"""
|
||||
response = requests.post(f"{BASE_URL}/auth/login", json=LOGIN_DATA)
|
||||
if response.status_code == 200:
|
||||
return response.json()["access_token"]
|
||||
else:
|
||||
print(f"Login failed: {response.status_code}")
|
||||
return None
|
||||
|
||||
|
||||
def test_bulk_shot_creation():
|
||||
"""Test bulk shot creation"""
|
||||
print("=== Test: Bulk Shot Creation ===\n")
|
||||
|
||||
token = login()
|
||||
if not token:
|
||||
return
|
||||
|
||||
headers = {"Authorization": f"Bearer {token}"}
|
||||
project_id = 1
|
||||
episode_id = 1
|
||||
|
||||
# Test bulk shot creation
|
||||
print("1. Creating 3 shots with bulk creation...")
|
||||
import time
|
||||
timestamp = int(time.time())
|
||||
bulk_data = {
|
||||
"name_prefix": f"BULK_{timestamp}_",
|
||||
"shot_count": 3,
|
||||
"start_number": 1,
|
||||
"number_padding": 3,
|
||||
"frame_start": 1001,
|
||||
"frame_end": 1100,
|
||||
"description_template": "Test shot {shot_name}",
|
||||
"create_default_tasks": True
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
f"{BASE_URL}/shots/bulk?episode_id={episode_id}",
|
||||
headers=headers,
|
||||
json=bulk_data
|
||||
)
|
||||
|
||||
print(f" Status: {response.status_code}")
|
||||
if response.status_code == 201:
|
||||
result = response.json()
|
||||
print(f" Message: {result['message']}")
|
||||
print(f" Created shots: {len(result['created_shots'])}")
|
||||
print(f" Created tasks: {result['created_tasks_count']}")
|
||||
print(f"\n Shot names:")
|
||||
for shot in result['created_shots']:
|
||||
print(f" - {shot['name']} (ID: {shot['id']}, Tasks: {shot['task_count']})")
|
||||
else:
|
||||
print(f" Error: {response.json()}")
|
||||
|
||||
print("\n=== Test Completed ===")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_bulk_shot_creation()
|
||||
Reference in New Issue
Block a user