-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api_format.py
More file actions
63 lines (46 loc) · 2.59 KB
/
test_api_format.py
File metadata and controls
63 lines (46 loc) · 2.59 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
#!/usr/bin/env python3
"""
Solved.ac API 형식 테스트 스크립트
수정된 fetch_problems_detail 함수의 URL 형식 검증
"""
import asyncio
import sys
sys.path.insert(0, '/app')
from app.services.solved_client import SolvedAPIClient
async def test_fetch_problems():
"""문제 조회 테스트"""
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
print("🧪 Solved.ac API 형식 테스트")
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
print()
client = SolvedAPIClient()
# 테스트 1: 3개 문제 조회
print("📋 테스트 1: 문제 1000, 1001, 1002 조회")
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
test_ids = [1000, 1001, 1002]
problems = await client.fetch_problems_detail(test_ids)
print()
print(f"✅ 조회된 문제 수: {len(problems)}개")
print()
for problem in problems:
print(f" - [{problem['problemId']}] {problem['titleKo']} (Level: {problem['level']})")
print()
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
print()
# 테스트 2: 5개 문제 조회
print("📋 테스트 2: 문제 1003~1007 조회")
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
test_ids = [1003, 1004, 1005, 1006, 1007]
problems = await client.fetch_problems_detail(test_ids)
print()
print(f"✅ 조회된 문제 수: {len(problems)}개")
print()
for problem in problems:
print(f" - [{problem['problemId']}] {problem['titleKo']} (Level: {problem['level']})")
print()
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
print("✅ 테스트 완료!")
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
await client.close()
if __name__ == "__main__":
asyncio.run(test_fetch_problems())