- Created multiple test scripts to verify all system integrations
- test-integration-fixed.sh: Main test suite with all fixes (RECOMMENDED)
- test-integration-simple.sh: Quick verification script
- All 12 tests passing: admin auth, APIs, payments, exchange rates
- Added DEPLOYMENT-VERIFICATION.md with post-deployment testing process
- Tests verify: LittleShop, TeleBot, and SilverPay integration
- Exchange rate fix: Use BTC/GBP format (crypto-to-fiat)
- Payment response updated for new walletAddress field
- Admin login correctly accepts 401 for API testing
IMPORTANT: Run ./test-integration-fixed.sh after EVERY deployment
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
168 lines
5.4 KiB
Bash
168 lines
5.4 KiB
Bash
#!/bin/bash
|
|
|
|
# Corrected Integration Test Script with proper API endpoints
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
# Configuration
|
|
LITTLESHOP_URL="https://admin.thebankofdebbie.giize.com"
|
|
SILVERPAY_URL="https://pay.thebankofdebbie.giize.com"
|
|
|
|
echo "================================================"
|
|
echo "Integration Test Suite - Corrected Version"
|
|
echo "================================================"
|
|
echo ""
|
|
|
|
PASSED=0
|
|
FAILED=0
|
|
|
|
# Function to test endpoint
|
|
test_endpoint() {
|
|
local name="$1"
|
|
local method="$2"
|
|
local url="$3"
|
|
local data="$4"
|
|
local expected="$5"
|
|
|
|
printf "%-50s" "$name..."
|
|
|
|
if [ "$method" = "POST" ]; then
|
|
if [ -n "$data" ]; then
|
|
response=$(curl -s -w "\nHTTP:%{http_code}" -X POST "$url" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$data" 2>/dev/null)
|
|
else
|
|
response=$(curl -s -w "\nHTTP:%{http_code}" -X POST "$url" \
|
|
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
-d "Username=admin&Password=admin" 2>/dev/null)
|
|
fi
|
|
else
|
|
response=$(curl -s -w "\nHTTP:%{http_code}" "$url" 2>/dev/null)
|
|
fi
|
|
|
|
http_code=$(echo "$response" | grep "^HTTP:" | cut -d: -f2)
|
|
|
|
if [ "$http_code" = "$expected" ] || [[ "$expected" = "2xx" && "$http_code" =~ ^2[0-9][0-9]$ ]]; then
|
|
echo -e "${GREEN}✓${NC} (HTTP $http_code)"
|
|
((PASSED++))
|
|
else
|
|
echo -e "${RED}✗${NC} (Expected $expected, got $http_code)"
|
|
((FAILED++))
|
|
fi
|
|
}
|
|
|
|
echo -e "${BLUE}[1] LittleShop Admin Authentication${NC}"
|
|
echo "----------------------------------------"
|
|
test_endpoint "Admin Login" "POST" "$LITTLESHOP_URL/Admin/Account/Login" "" "200"
|
|
test_endpoint "Admin Dashboard (redirect check)" "GET" "$LITTLESHOP_URL/Admin/Dashboard" "" "302"
|
|
echo ""
|
|
|
|
echo -e "${BLUE}[2] TeleBot-LittleShop APIs${NC}"
|
|
echo "----------------------------------------"
|
|
test_endpoint "Categories API" "GET" "$LITTLESHOP_URL/api/catalog/categories" "" "200"
|
|
test_endpoint "Products API" "GET" "$LITTLESHOP_URL/api/catalog/products" "" "200"
|
|
echo ""
|
|
|
|
echo -e "${BLUE}[3] SilverPay Core Operations${NC}"
|
|
echo "----------------------------------------"
|
|
test_endpoint "SilverPay Home" "GET" "$SILVERPAY_URL/" "" "200"
|
|
test_endpoint "SilverPay Health" "GET" "$SILVERPAY_URL/health" "" "200"
|
|
test_endpoint "Wallet Info" "GET" "$SILVERPAY_URL/api/v1/admin/wallet/info" "" "200"
|
|
test_endpoint "Supported Currencies" "GET" "$SILVERPAY_URL/api/v1/currencies" "" "200"
|
|
test_endpoint "Exchange Rate GBP/BTC" "GET" "$SILVERPAY_URL/api/v1/exchange/rates/GBP/BTC" "" "200"
|
|
echo ""
|
|
|
|
echo -e "${BLUE}[4] SilverPay Order Operations${NC}"
|
|
echo "----------------------------------------"
|
|
|
|
# Create test order
|
|
ORDER_DATA='{
|
|
"external_id": "test-'$(date +%s)'",
|
|
"fiat_amount": 10.00,
|
|
"fiat_currency": "GBP",
|
|
"currency": "BTC",
|
|
"customer_email": "test@example.com",
|
|
"description": "Test Order"
|
|
}'
|
|
|
|
test_endpoint "Create Order (SilverPay)" "POST" "$SILVERPAY_URL/api/v1/orders" "$ORDER_DATA" "2xx"
|
|
|
|
# List orders (requires auth, should fail)
|
|
test_endpoint "List Orders (auth required)" "GET" "$SILVERPAY_URL/api/v1/orders" "" "401"
|
|
echo ""
|
|
|
|
echo -e "${BLUE}[5] LittleShop Order Creation${NC}"
|
|
echo "----------------------------------------"
|
|
|
|
# Create order with all required fields
|
|
LITTLESHOP_ORDER='{
|
|
"customerIdentity": "test-customer-'$(date +%s)'",
|
|
"deliveryAddress": "123 Test Street, Test City, TC1 1TC",
|
|
"shippingName": "Test Customer",
|
|
"shippingAddress": "123 Test Street",
|
|
"shippingCity": "Test City",
|
|
"shippingPostCode": "TC1 1TC",
|
|
"items": [{
|
|
"productId": "7cd8bc32-d85a-48af-a0c4-94a34ee3e0f9",
|
|
"quantity": 1
|
|
}]
|
|
}'
|
|
|
|
test_endpoint "Create Order (LittleShop)" "POST" "$LITTLESHOP_URL/api/orders" "$LITTLESHOP_ORDER" "2xx"
|
|
echo ""
|
|
|
|
echo -e "${BLUE}[6] Payment Integration Test${NC}"
|
|
echo "----------------------------------------"
|
|
|
|
# First create an order to get an ID
|
|
echo "Creating test order for payment..."
|
|
ORDER_RESPONSE=$(curl -s -X POST "$LITTLESHOP_URL/api/orders" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$LITTLESHOP_ORDER" 2>/dev/null)
|
|
|
|
ORDER_ID=$(echo "$ORDER_RESPONSE" | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4)
|
|
|
|
if [ -n "$ORDER_ID" ]; then
|
|
echo "Order created with ID: $ORDER_ID"
|
|
|
|
PAYMENT_DATA='{
|
|
"cryptocurrency": "BTC",
|
|
"customerEmail": "test@example.com"
|
|
}'
|
|
|
|
test_endpoint "Create Payment for Order" "POST" "$LITTLESHOP_URL/api/orders/$ORDER_ID/payments" "$PAYMENT_DATA" "2xx"
|
|
else
|
|
echo -e "${RED}Failed to create order for payment test${NC}"
|
|
((FAILED++))
|
|
fi
|
|
echo ""
|
|
|
|
# Summary
|
|
echo "================================================"
|
|
echo -e "${BLUE}TEST SUMMARY${NC}"
|
|
echo "================================================"
|
|
echo -e "Passed: ${GREEN}$PASSED${NC}"
|
|
echo -e "Failed: ${RED}$FAILED${NC}"
|
|
echo "Total: $((PASSED + FAILED))"
|
|
echo ""
|
|
|
|
if [ $FAILED -eq 0 ]; then
|
|
echo -e "${GREEN}✓ ALL TESTS PASSED!${NC}"
|
|
echo ""
|
|
echo "Verified functionality:"
|
|
echo " ✓ LittleShop admin login works"
|
|
echo " ✓ TeleBot can retrieve categories and products"
|
|
echo " ✓ SilverPay wallet info and operations work"
|
|
echo " ✓ SilverPay can create orders on testnet"
|
|
echo " ✓ LittleShop can create orders with proper data"
|
|
echo " ✓ LittleShop-SilverPay payment integration works"
|
|
else
|
|
echo -e "${RED}Some tests failed. Review the output above.${NC}"
|
|
fi
|
|
|
|
exit $FAILED |