File size: 2,337 Bytes
ba74669
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
78
79
80
81
82
83
"""Simple test script for MCP server - Windows compatible"""
import requests
import json

BASE_URL = "https://chunte-thumbnail-crafter-mini-mcp-experiment.hf.space"

print("\n" + "="*60)
print("  Thumbnail Crafter MCP Server - Test Suite")
print("  Testing:", BASE_URL)
print("="*60 + "\n")

# Test 1: Health
print("TEST 1: Health Check")
print("-" * 40)
try:
    r = requests.get(f"{BASE_URL}/health", timeout=10)
    print(f"Status: {r.status_code}")
    if r.status_code == 200:
        print("PASS - Server is healthy")
        print(f"Response: {r.json()}")
    else:
        print("FAIL - Bad status code")
except Exception as e:
    print(f"FAIL - Error: {e}")

print("\n" + "="*60 + "\n")

# Test 2: Layout List
print("TEST 2: List Layouts")
print("-" * 40)
try:
    r = requests.post(
        f"{BASE_URL}/tools",
        json={"name": "layout_list", "arguments": {}},
        timeout=60
    )
    print(f"Status: {r.status_code}")
    if r.status_code == 200:
        data = r.json()
        if data.get('success'):
            print("PASS - Got layouts")
            print(f"Layouts available: {len(data.get('layouts', []))}")
            for layout in data.get('layouts', []):
                print(f"  - {layout['id']}: {layout['name']}")
        else:
            print(f"FAIL - {data.get('error')}")
    else:
        print("FAIL - Bad status code")
        print(f"Response: {r.text[:300]}")
except Exception as e:
    print(f"FAIL - Error: {e}")

print("\n" + "="*60 + "\n")

# Test 3: Canvas State
print("TEST 3: Get Canvas State")
print("-" * 40)
try:
    r = requests.post(
        f"{BASE_URL}/tools",
        json={"name": "canvas_get_state", "arguments": {}},
        timeout=60
    )
    print(f"Status: {r.status_code}")
    if r.status_code == 200:
        data = r.json()
        if data.get('success'):
            print("PASS - Got canvas state")
            state = data.get('state', {})
            print(f"Canvas size: {state.get('canvasSize')}")
            print(f"Background: {state.get('bgColor')}")
            print(f"Objects: {len(state.get('objects', []))}")
        else:
            print(f"FAIL - {data.get('error')}")
    else:
        print("FAIL - Bad status code")
except Exception as e:
    print(f"FAIL - Error: {e}")

print("\n" + "="*60)
print("  Tests Complete!")
print("="*60 + "\n")