banatie-service/test-api.sh

32 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Test script for Banatie API endpoints
BASE_URL="http://localhost:3000"
echo "🧪 Testing Banatie API Endpoints"
echo "================================"
# Test 1: Health check
echo "1. Testing health endpoint..."
curl -s "$BASE_URL/health" | jq '.' || echo "Health endpoint failed"
echo -e "\n"
# Test 2: API info
echo "2. Testing API info endpoint..."
curl -s "$BASE_URL/api/info" | jq '.' || echo "API info endpoint failed"
echo -e "\n"
# Test 3: Generate endpoint validation (should fail without prompt)
echo "3. Testing generate endpoint validation..."
curl -s -X POST "$BASE_URL/api/generate" \
-F "filename=test" | jq '.' || echo "Generate endpoint validation test failed"
echo -e "\n"
# Test 4: Generate endpoint validation (should fail without API key)
echo "4. Testing generate endpoint with prompt (should fail without valid API key)..."
curl -s -X POST "$BASE_URL/api/generate" \
-F "prompt=A simple test image" \
-F "filename=test" | jq '.' || echo "Generate endpoint test failed"
echo -e "\n"
echo "✅ API tests completed!"