aboutsummaryrefslogtreecommitdiff
path: root/api/tests.sh
blob: 38826994de2ace0b5ed9283caaa76b35973d740b (plain)
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
#!/bin/sh

username="test_$RANDOM"
email="$username@example.com"
password=$(echo $RANDOM | base64)

signup () {
	curl -X POST \
		-H "Content-Type: application/json" \
		-d "{
		\"username\": \"$username\",
		\"email\": \"$email\",
		\"password\": \"$password\"
		}" \
		localhost:5000/api/auth/signup
}

login_username () {
	curl -X POST \
		-H "Content-Type: application/json" \
		-d "{
		\"email\": \"$username\",
		\"password\": \"$password\"
		}" \
		localhost:5000/api/auth/login
}

login_email () {
	curl -X POST \
		-H "Content-Type: application/json" \
		-d "{
		\"email\": \"$email\",
		\"password\": \"$password\"
		}" \
		localhost:5000/api/auth/login
}

user_info () {
	curl -X GET \
		-H "Content-Type: application/json" \
		-d '{
		"username": "loekaars"
		}' \
		localhost:5000/api/user/info
}

# login_token () {
# 	curl -X POST \
# 		-H "Content-Type: application/json" \
# 		-d "{
# 		\"user_id\": \"2dc82ac3-e3c1-4a0e-b024-c6224107ff59\",
# 		\"token\": \"beda7848ac601d80ac88bfc629d13ed6dc27dabd29a3e1db5b2a93839bd6dd3c79e25ea939d13789fdec74edafa18b4040d39729c282f28f82f366d44b5455cd8e3c28b59da2c397ff4e637a99c3ccbea4af00828ab7094b5285b8f900e31e833b5e55994e68e3de7e7fbeb02adc74231f63173e84f7e22aef97f9c7bfd920a1\"
# 		}" \
# 		localhost:5000/api/auth/token
# }

new_game () {
	curl -X POST \
		-H "Content-Type: application/json" \
		-d '{
			"user_id": "4577c119-c768-4ad5-afec-b53a5c19baf4",
			"settings": {
				"ranked": true,
				"timelimit": {
					"minutes": 5,
					"seconds": 30,
					"enabled": true,
					"shared": "false"
				}
			}
		}' \
		localhost:5000/game/new
}

new_game