furt/scripts/test_modular.sh
michael 08b49d3d75 security: sanitize internal infrastructure details from open source package
- Remove production_test_sequence.sh (DAW-specific production tests)
- Remove setup_env.sh (obsolete .env setup, replaced by furt.conf)
- Sanitize test scripts: replace dragons-at-work.de with example.com
- Sanitize API keys: replace dev keys with placeholder values
- Remove hardcoded DAW fallbacks from http_server.lua and smtp.lua
- Update .gitignore to exclude production-specific test files

Tests remain functional for developers with example domains.
All internal DAW infrastructure details removed from package.

Closes #101
2025-09-07 21:25:25 +02:00

61 lines
1.9 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# furt-lua/scripts/test_modular.sh
# Test der modularen Furt-Architektur
BASE_URL="http://127.0.0.1:8080"
HUGO_API_KEY="YOUR_API_KEY_HERE"
echo "🧩 Testing Modular Furt Architecture"
echo "===================================="
# Test 1: Module dependencies check
echo -e "\n1⃣ Testing module imports (should not error on startup):"
echo "Starting server in background..."
cd "$(dirname "$0")/.."
lua src/main.lua &
SERVER_PID=$!
sleep 2
if kill -0 $SERVER_PID 2>/dev/null; then
echo "✅ Server started successfully - all modules loaded"
else
echo "❌ Server failed to start - module import error"
exit 1
fi
# Test 2: Public endpoints (no auth)
echo -e "\n2⃣ Testing public endpoints:"
curl -s -w "Status: %{http_code}\n" "$BASE_URL/health" | jq '.features'
# Test 3: Protected endpoints without auth (should fail)
echo -e "\n3⃣ Testing auth protection:"
curl -s -w "Status: %{http_code}\n" \
-X POST \
-H "Content-Type: application/json" \
-d '{"name":"Test","email":"test@example.com","message":"Test"}' \
"$BASE_URL/v1/mail/send" | jq '.error'
# Test 4: Protected endpoints with auth (should work)
echo -e "\n4⃣ Testing authenticated request:"
curl -s -w "Status: %{http_code}\n" \
-H "X-API-Key: $HUGO_API_KEY" \
"$BASE_URL/v1/auth/status" | jq '.'
# Test 5: Rate limiting headers
echo -e "\n5⃣ Testing rate limit headers:"
curl -s -i -H "X-API-Key: $HUGO_API_KEY" "$BASE_URL/v1/auth/status" | grep -E "X-RateLimit|HTTP"
# Cleanup
echo -e "\n🧹 Cleanup:"
kill $SERVER_PID 2>/dev/null
wait $SERVER_PID 2>/dev/null
echo "Server stopped"
echo -e "\n✅ Modular Architecture Test Complete!"
echo "Expected behavior:"
echo "- Test 1: ✅ Server starts without module errors"
echo "- Test 2: ✅ Health endpoint works, shows features"
echo "- Test 3: ❌ 401 Unauthorized (missing API key)"
echo "- Test 4: ✅ 200 OK with auth details"
echo "- Test 5: ✅ Rate limit headers present"