-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_api.py
More file actions
48 lines (39 loc) · 1.28 KB
/
Copy pathtest_api.py
File metadata and controls
48 lines (39 loc) · 1.28 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
"""
Quick test of the OptionsAI API when used programmatically
"""
import sys
import os
# Add src to path for testing
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
try:
from main import OptionsAI
from config import Config
# Test 1: Basic initialization
print("Testing OptionsAI initialization...")
ai = OptionsAI()
print("✅ OptionsAI initialization successful")
# Test 2: Version method
print("Testing version method...")
version = OptionsAI.version()
if version == "1.0.0":
print("✅ Version method works")
else:
print(f"❌ Version method returned: {version}")
# Test 3: Configuration loading
print("Testing configuration loading...")
config = Config()
print(f"✅ Config loaded - API port: {config.api.port}")
# Test 4: Config update
print("Testing configuration update...")
ai.update_config(recommendation__confidence_threshold=0.8)
if ai.config.recommendation.confidence_threshold == 0.8:
print("✅ Configuration update works")
else:
print("❌ Configuration update failed")
print("\n✅ All API tests passed!")
except Exception as e:
print(f"❌ API test failed: {e}")
import traceback
traceback.print_exc()
sys.exit(1)