-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api.sh
More file actions
executable file
·83 lines (71 loc) · 2.33 KB
/
Copy pathtest_api.sh
File metadata and controls
executable file
·83 lines (71 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# Davidson Model API Test Script
# This script demonstrates how to use the Davidson model prediction API
API_BASE_URL="http://localhost:8000/api/v1"
API_KEY="davidson-model-example-key"
echo "🏈 Davidson Model Prediction API Test"
echo "====================================="
# Test 1: Health Check (no auth required)
echo ""
echo "1. Testing Health Check (no authentication required)..."
curl -X GET "${API_BASE_URL}/health" \
-H "Content-Type: application/json" \
| python -m json.tool
echo ""
echo "====================================="
# Test 2: Prediction with Authentication (two games)
echo ""
echo "2. Testing Davidson Model Predictions with Authentication..."
# Create JSON payload with two games from supported leagues
PAYLOAD='[
{
"challengeId": "test-game-001",
"homeTeam": "Man United",
"awayTeam": "Liverpool",
"league": "Premier League",
"venue": "Old Trafford",
"fixtureId": 12345,
"kickoffTime": "2024-01-15T15:00:00Z",
"challengePhaseMinutes": 90,
"targetMarket": "1X2",
"phaseIdentifier": "FT",
"difficulty": 0.7
},
{
"challengeId": "test-game-002",
"homeTeam": "Barcelona",
"awayTeam": "Real Madrid",
"league": "La Liga",
"venue": "Camp Nou",
"fixtureId": 67890,
"kickoffTime": "2024-01-15T20:00:00Z",
"challengePhaseMinutes": 90,
"targetMarket": "1X2",
"phaseIdentifier": "FT",
"difficulty": 0.8
}
]'
curl -X POST "${API_BASE_URL}/predict" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${API_KEY}" \
-d "${PAYLOAD}" \
| python -m json.tool
echo ""
echo "====================================="
# Test 3: Prediction without Authentication (should fail)
echo ""
echo "3. Testing Predictions without Authentication (should fail)..."
curl -X POST "${API_BASE_URL}/predict" \
-H "Content-Type: application/json" \
-d "${PAYLOAD}" \
| python -m json.tool
echo ""
echo "====================================="
echo "✅ Test completed!"
echo ""
echo "Expected results:"
echo "- Health check: Should show Davidson model status and available leagues"
echo "- Authenticated prediction: Should return Davidson model predictions for both games"
echo "- Unauthenticated prediction: Should return 'Not authenticated' error"
echo ""
echo "Note: If teams are not in the training data, predictions may fail with 422 error"