50 lines
1.7 KiB
Bash
Executable File
50 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "🔍 Testing Samba API Endpoints"
|
|
echo "================================"
|
|
|
|
# Test HTTP endpoint
|
|
echo "📡 Testing HTTP endpoint..."
|
|
HTTP_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:8000/ || echo "ERROR")
|
|
if [ "$HTTP_RESPONSE" = '{"message":"Samba API is running","version":"1.0.0"}200' ]; then
|
|
echo "✅ HTTP (port 8000): Working"
|
|
else
|
|
echo "❌ HTTP (port 8000): Failed - $HTTP_RESPONSE"
|
|
fi
|
|
|
|
# Test HTTPS endpoint
|
|
echo "🔒 Testing HTTPS endpoint..."
|
|
HTTPS_RESPONSE=$(curl -k -s -w "%{http_code}" https://localhost:8443/ || echo "ERROR")
|
|
if [ "$HTTPS_RESPONSE" = '{"message":"Samba API is running","version":"1.0.0"}200' ]; then
|
|
echo "✅ HTTPS (port 8443): Working"
|
|
else
|
|
echo "❌ HTTPS (port 8443): Failed - $HTTPS_RESPONSE"
|
|
fi
|
|
|
|
# Test Health endpoint over HTTPS
|
|
echo "🏥 Testing Health endpoint..."
|
|
HEALTH_RESPONSE=$(curl -k -s -w "%{http_code}" https://localhost:8443/health || echo "ERROR")
|
|
if [[ "$HEALTH_RESPONSE" =~ "200"$ ]]; then
|
|
echo "✅ Health check: Working"
|
|
else
|
|
echo "❌ Health check: Failed - $HEALTH_RESPONSE"
|
|
fi
|
|
|
|
# Test API Documentation
|
|
echo "📚 Testing API Documentation..."
|
|
DOCS_RESPONSE=$(curl -k -s -w "%{http_code}" https://localhost:8443/docs | tail -c 3)
|
|
if [ "$DOCS_RESPONSE" = "200" ]; then
|
|
echo "✅ API Docs: Working"
|
|
else
|
|
echo "❌ API Docs: Failed"
|
|
fi
|
|
|
|
echo ""
|
|
echo "🔗 Available Endpoints:"
|
|
echo " • HTTP API: http://localhost:8000"
|
|
echo " • HTTPS API: https://localhost:8443"
|
|
echo " • API Docs: https://localhost:8443/docs"
|
|
echo " • Health: https://localhost:8443/health"
|
|
echo ""
|
|
echo "💡 Use 'curl -k' for HTTPS requests with self-signed certificates"
|
|
echo "💡 Access API documentation in browser: https://localhost:8443/docs" |