teszt állományok áthelyezése és szelektálása

This commit is contained in:
Roo
2026-06-05 10:50:25 +00:00
parent 18524a08f2
commit f03b5f3916
63 changed files with 633 additions and 527 deletions

91
tests/archive/test_mvp.sh.old Executable file
View File

@@ -0,0 +1,91 @@
#!/bin/bash
set -e
BASE_URL="http://192.168.100.10:8000/api/v1"
HEADERS="Content-Type: application/json"
echo "=== MVP Funkciók Tesztelése ==="
# 1. Bejelentkezés
echo -e "\n1. Bejelentkezés..."
LOGIN_RESP=$(curl -s -X POST "$BASE_URL/auth/login" \
-H "$HEADERS" \
-d '{"username": "test@profibot.hu", "password": "test123"}')
echo "Login response: $LOGIN_RESP"
TOKEN=$(echo "$LOGIN_RESP" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
if [ -z "$TOKEN" ]; then
echo "First login failed, trying testuser@example.com"
LOGIN_RESP=$(curl -s -X POST "$BASE_URL/auth/login" \
-H "$HEADERS" \
-d '{"username": "testuser@example.com", "password": "TestPass123!"}')
echo "Second login response: $LOGIN_RESP"
TOKEN=$(echo "$LOGIN_RESP" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
fi
if [ -z "$TOKEN" ]; then
echo "ERROR: Could not obtain access token. Exiting."
exit 1
fi
echo "Token obtained: ${TOKEN:0:20}..."
AUTH_HEADER="Authorization: Bearer $TOKEN"
# 2. Jármű rögzítése
echo -e "\n2. Jármű rögzítése..."
VEHICLE_RESP=$(curl -s -X POST "$BASE_URL/assets/vehicles" \
-H "$HEADERS" \
-H "$AUTH_HEADER" \
-d '{
"plate_number": "ABC-123",
"vin": "1HGCM82633A123456",
"make": "Honda",
"model": "Accord",
"year": 2020
}')
echo "Vehicle creation response: $VEHICLE_RESP"
ASSET_ID=$(echo "$VEHICLE_RESP" | grep -o '"asset_id":"[^"]*"' | cut -d'"' -f4)
if [ -n "$ASSET_ID" ]; then
echo "Vehicle created with asset_id: $ASSET_ID"
# 3. Jármű költség rögzítése
echo -e "\n3. Jármű költség rögzítése..."
EXPENSE_RESP=$(curl -s -X POST "$BASE_URL/expenses/" \
-H "$HEADERS" \
-H "$AUTH_HEADER" \
-d "{
\"asset_id\": \"$ASSET_ID\",
\"cost_type\": \"fuel\",
\"amount\": 15000,
\"currency\": \"HUF\",
\"odometer\": 50000,
\"description\": \"Tankolás\"
}")
echo "Expense creation response: $EXPENSE_RESP"
else
echo "Skipping expense creation - no asset_id"
fi
# 4. Szervizpont keresés
echo -e "\n4. Szervizpont keresés..."
SERVICE_RESP=$(curl -s -X GET "$BASE_URL/services/search?query=autószerviz" \
-H "$AUTH_HEADER")
echo "Service search response: $SERVICE_RESP"
# 5. Gamification státusz
echo -e "\n5. Gamification státusz lekérése..."
GAMIFICATION_RESP=$(curl -s -X GET "$BASE_URL/gamification/my-stats" \
-H "$AUTH_HEADER")
echo "Gamification stats response: $GAMIFICATION_RESP"
# 6. Wallet egyenleg
echo -e "\n6. Wallet egyenleg lekérése..."
USER_RESP=$(curl -s -X GET "$BASE_URL/users/me" \
-H "$AUTH_HEADER")
echo "User wallet balance response: $USER_RESP"
echo -e "\n=== Tesztelés befejezve ==="