File size: 1,606 Bytes
7657e9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
# Test script for Platform
# Run this after building the Docker container

set -e

echo "========================================="
echo "  Platform - Test Suite"
echo "========================================="

PLATFORM_URL="${PLATFORM_URL:-http://localhost:7860}"
PASS=0
FAIL=0

test_endpoint() {
    local name=$1
    local path=$2
    local expected_status=$3

    status=$(curl -s -o /dev/null -w "%{http_code}" "$PLATFORM_URL$path" 2>/dev/null || echo "000")

    if [ "$status" = "$expected_status" ]; then
        echo "[PASS] $name - $path ($status)"
        PASS=$((PASS + 1))
    else
        echo "[FAIL] $name - $path (expected $expected_status, got $status)"
        FAIL=$((FAIL + 1))
    fi
}

echo ""
echo "Testing endpoints at $PLATFORM_URL..."
echo ""

# Health check
test_endpoint "Health" "/health" "200"

# API docs
test_endpoint "API Docs" "/api/docs" "200"

# Auth endpoints
test_endpoint "Auth Register" "/api/auth/register" "422"
test_endpoint "Auth Login" "/api/auth/login" "405"

# Apps endpoints (should return empty list without auth)
test_endpoint "Apps List" "/api/apps" "200"

# Settings
test_endpoint "Settings" "/api/settings" "200"
test_endpoint "Health Check" "/api/settings/health" "200"

# MCP endpoints
test_endpoint "MCP Discovery" "/mcp/v1/discovery" "200"
test_endpoint "MCP Tools" "/mcp/v1/tools" "200"

# Static files
test_endpoint "Frontend SPA" "/" "200"

echo ""
echo "========================================="
echo "  Results: $PASS passed, $FAIL failed"
echo "========================================="

if [ $FAIL -gt 0 ]; then
    exit 1
fi