53 lines
1.4 KiB
Bash
Executable file
53 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# API Testing Script for Normogen Backend (Remote Server)
|
|
# Server is running at 10.0.10.30:6800
|
|
|
|
echo "🧪 Testing Normogen API Endpoints at http://10.0.10.30:6800"
|
|
echo "================================================================"
|
|
echo ""
|
|
|
|
# Test 1: Health Check
|
|
echo "1. Testing Health Check..."
|
|
HEALTH=$(curl -s -w "
|
|
HTTP Status: %{http_code}
|
|
" http://10.0.10.30:6800/health)
|
|
echo "$HEALTH"
|
|
echo ""
|
|
|
|
# Test 2: Ready Check
|
|
echo "2. Testing Ready Check..."
|
|
READY=$(curl -s -w "
|
|
HTTP Status: %{http_code}
|
|
" http://10.0.10.30:6800/ready)
|
|
echo "$READY"
|
|
echo ""
|
|
|
|
# Test 3: Register User
|
|
echo "3. Testing User Registration..."
|
|
REGISTER=$(curl -s -w "
|
|
HTTP Status: %{http_code}
|
|
" -X POST http://10.0.10.30:6800/api/auth/register \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email": "test@example.com", "password": "SecurePassword123!", "username": "testuser"}')
|
|
echo "$REGISTER"
|
|
echo ""
|
|
|
|
# Test 4: Login
|
|
echo "4. Testing User Login..."
|
|
LOGIN=$(curl -s -w "
|
|
HTTP Status: %{http_code}
|
|
" -X POST http://10.0.10.30:6800/api/auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email": "test@example.com", "password": "SecurePassword123!"}')
|
|
echo "$LOGIN"
|
|
echo ""
|
|
|
|
# Test 5: Protected Endpoint (should fail without auth)
|
|
echo "5. Testing Protected Endpoint (without auth, should fail)..."
|
|
PROFILE=$(curl -s -w "
|
|
HTTP Status: %{http_code}
|
|
" http://10.0.10.30:6800/api/users/me)
|
|
echo "$PROFILE"
|
|
echo ""
|
|
|
|
echo "✅ Tests complete!"
|