42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
import sys
|
|
import os
|
|
import time
|
|
import subprocess
|
|
import threading
|
|
|
|
# Add project root to path
|
|
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
if project_root not in sys.path:
|
|
sys.path.insert(0, project_root)
|
|
|
|
import gui.web_gui as wg
|
|
|
|
def test_server():
|
|
# Start server in background thread
|
|
def run_server():
|
|
try:
|
|
wg.main()
|
|
except SystemExit:
|
|
pass
|
|
|
|
server_thread = threading.Thread(target=run_server, daemon=True)
|
|
server_thread.start()
|
|
|
|
# Wait for server to start
|
|
time.sleep(2)
|
|
|
|
# Test API
|
|
try:
|
|
import requests
|
|
response = requests.get('http://localhost:8001/api/config', timeout=5)
|
|
print(f"Status: {response.status_code}")
|
|
print(f"Response length: {len(response.text)}")
|
|
data = response.json()
|
|
print(f"Config keys: {len(data)}")
|
|
print(f"Sample keys: {list(data.keys())[:5]}")
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
test_server()
|