-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-api.sh
More file actions
executable file
·60 lines (53 loc) · 1.66 KB
/
test-api.sh
File metadata and controls
executable file
·60 lines (53 loc) · 1.66 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
#!/bin/bash
echo "Testing Vikings Rise Simulator API endpoints..."
echo
echo "1. Testing Health endpoint:"
curl -s http://localhost:8080/health | python3 -c "import sys, json; print(json.dumps(json.load(sys.stdin), indent=2))"
echo
echo "2. Testing API Info endpoint:"
curl -s http://localhost:8080/api | python3 -c "import sys, json; print(json.dumps(json.load(sys.stdin), indent=2))"
echo
echo "3. Testing Skills endpoint (first 5):"
curl -s http://localhost:8080/api/skills | python3 -c "import sys, json; skills = json.load(sys.stdin); print(json.dumps(skills[:5], indent=2))"
echo
echo "4. Testing Commanders endpoint:"
curl -s http://localhost:8080/api/commanders | python3 -c "import sys, json; print(json.dumps(json.load(sys.stdin), indent=2))"
echo
echo "5. Testing Simulation endpoint with correct data structure:"
curl -s -X POST -H "Content-Type: application/json" -d '{
"config": {
"type": "trades",
"rounds": 10,
"fights": 1,
"fightLength": 300,
"fightsPerLength": 1
},
"marches": [
{
"id": "march1",
"primaryCommander": "Vali",
"secondaryCommander": "N/A",
"attack": 100.0,
"defense": 100.0,
"health": 100.0,
"troopSize": 10000,
"isFriendly": true,
"isRally": false,
"skills": ["Divine Blessing", "First Strike"]
},
{
"id": "march2",
"primaryCommander": "Gunnar",
"secondaryCommander": "N/A",
"attack": 100.0,
"defense": 100.0,
"health": 100.0,
"troopSize": 10000,
"isFriendly": false,
"isRally": false,
"skills": ["Enrage", "Fiery Rage"]
}
]
}' http://localhost:8080/api/simulate
echo
echo "API testing completed!"