-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_debug.py
More file actions
77 lines (63 loc) · 2.28 KB
/
test_debug.py
File metadata and controls
77 lines (63 loc) · 2.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""디버그 테스트"""
import os
import sys
import traceback
print("🔍 디버그 테스트 시작")
print("=" * 50)
# 환경 변수 설정
os.environ["OPENROUTER_BASE_URL"] = "https://openrouter.ai/api/v1"
os.environ["OPENROUTER_API_KEY"] = "test_key"
# 1. 모듈 import 테스트
modules_to_test = [
"src.auth.auth_mw",
"src.store.threads",
"src.approvals.service",
"src.mcp_clients.taskmaster",
"src.mcp_clients.playwright",
"src.llm.usage",
"src.api.endpoints",
"src.main"
]
for module_name in modules_to_test:
try:
module = __import__(module_name, fromlist=[''])
print(f"✅ {module_name} import 성공")
except Exception as e:
print(f"❌ {module_name} import 실패: {e}")
traceback.print_exc()
print("\n" + "=" * 50)
# 2. FastAPI 테스트
print("\n🌐 FastAPI 테스트")
try:
from src.main import app
from fastapi.testclient import TestClient
client = TestClient(app)
# /approve 엔드포인트 테스트
print("\n POST /approve (인증 없음):")
response = client.post("/approve", json={"approval_id":"x","decision":"approve"})
print(f" 상태 코드: {response.status_code}")
print(f" 응답: {response.json()}")
# /threads 엔드포인트 테스트
print("\n GET /threads/test-123 (인증 없음):")
response = client.get("/threads/test-123")
print(f" 상태 코드: {response.status_code}")
print(f" 응답: {response.json()}")
# /plan 엔드포인트 테스트
print("\n POST /plan (인증 없음):")
response = client.post("/plan", json={"goal":"Test","constraints":[]})
print(f" 상태 코드: {response.status_code}")
print(f" 응답: {response.json()}")
# 인증 포함 테스트
print("\n POST /approve (인증 포함):")
response = client.post("/approve",
headers={"X-API-Key": "xxx"},
json={"approval_id":"x","decision":"approve"})
print(f" 상태 코드: {response.status_code}")
print(f" 응답: {response.json()}")
except Exception as e:
print(f"❌ FastAPI 테스트 실패: {e}")
traceback.print_exc()
print("\n" + "=" * 50)
print("🎯 디버그 테스트 완료!")