57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script to verify the new project fields work correctly
|
|
"""
|
|
|
|
import requests
|
|
import json
|
|
|
|
BASE_URL = "http://127.0.0.1:8000"
|
|
|
|
def test_project_creation():
|
|
"""Test creating a project with the new fields"""
|
|
|
|
# First, let's try to get an auth token (you'll need to have a user created)
|
|
# For now, let's just test the schema validation
|
|
|
|
project_data = {
|
|
"name": "Test VFX Project",
|
|
"code_name": "TEST_001",
|
|
"client_name": "Test Studio",
|
|
"project_type": "cinema",
|
|
"description": "A test project for cinema VFX",
|
|
"status": "planning"
|
|
}
|
|
|
|
print("Testing project creation with new fields:")
|
|
print(json.dumps(project_data, indent=2))
|
|
|
|
# Note: This will fail without authentication, but we can see if the schema is correct
|
|
try:
|
|
response = requests.post(f"{BASE_URL}/projects/", json=project_data)
|
|
print(f"Response status: {response.status_code}")
|
|
print(f"Response: {response.text}")
|
|
except Exception as e:
|
|
print(f"Request failed (expected without auth): {e}")
|
|
|
|
def test_project_types():
|
|
"""Test all project types"""
|
|
project_types = ["tv", "cinema", "game"]
|
|
|
|
for i, project_type in enumerate(project_types, 1):
|
|
project_data = {
|
|
"name": f"Test {project_type.upper()} Project",
|
|
"code_name": f"TEST_{i:03d}",
|
|
"client_name": f"Test {project_type.title()} Studio",
|
|
"project_type": project_type,
|
|
"description": f"A test project for {project_type} production",
|
|
"status": "planning"
|
|
}
|
|
|
|
print(f"\nTesting {project_type} project:")
|
|
print(json.dumps(project_data, indent=2))
|
|
|
|
if __name__ == "__main__":
|
|
test_project_creation()
|
|
test_project_types()
|
|
print("\nSchema validation test completed!") |