feat: Add API testing script
- Comprehensive test script for all API endpoints - Tests health check, API info, and validation - Easy way to verify server functionality - Includes JSON formatting with jq
This commit is contained in:
parent
52549836e4
commit
65fbcd0202
|
|
@ -0,0 +1,32 @@
|
|||
#!/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!"
|
||||
Loading…
Reference in New Issue