Init Repo
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Simple performance test
|
||||
"""
|
||||
|
||||
import requests
|
||||
import time
|
||||
|
||||
BASE_URL = 'http://localhost:8000'
|
||||
|
||||
def login():
|
||||
response = requests.post(f'{BASE_URL}/auth/login', json={'email': 'admin@vfx.com', 'password': 'admin123'})
|
||||
if response.status_code != 200:
|
||||
return None
|
||||
return response.json()['access_token']
|
||||
|
||||
def test_performance():
|
||||
token = login()
|
||||
if not token:
|
||||
return
|
||||
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
|
||||
# Test simple endpoint
|
||||
start_time = time.time()
|
||||
response = requests.get(f'{BASE_URL}/projects/', headers=headers)
|
||||
end_time = time.time()
|
||||
|
||||
print(f"Projects query: {response.status_code} in {end_time - start_time:.3f}s")
|
||||
|
||||
# Test shots query
|
||||
start_time = time.time()
|
||||
response = requests.get(f'{BASE_URL}/shots/?project_id=10', headers=headers)
|
||||
end_time = time.time()
|
||||
|
||||
print(f"Shots query: {response.status_code} in {end_time - start_time:.3f}s")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_performance()
|
||||
Reference in New Issue
Block a user