-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_api.py
More file actions
32 lines (26 loc) · 1.02 KB
/
test_api.py
File metadata and controls
32 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import requests
def test_analyze():
url = "http://localhost:8000/analyze"
# Create a dummy file
files = {'file': ('test.wav', b'dummy content', 'audio/wav')}
try:
response = requests.post(url, files=files)
response.raise_for_status()
data = response.json()
print("Analyze Response Status:", response.status_code)
print("Keys in response:", data.keys())
print("Verdict:", data.get('verdict'))
print("Confidence:", data.get('confidence_score'))
# Validate critical fields
required_keys = ['verdict', 'confidence_score', 'explanation', 'analysis', 'timeline_data', 'audio_fingerprint']
for key in required_keys:
if key not in data:
print(f"FAILED: Missing key {key}")
return False
print("Analyze Test PASSED")
return True
except Exception as e:
print(f"Analyze Test FAILED: {e}")
return False
if __name__ == "__main__":
test_analyze()