-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtesting.py
More file actions
52 lines (39 loc) · 1.67 KB
/
testing.py
File metadata and controls
52 lines (39 loc) · 1.67 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
import requests
BASE_URL = "http://192.168.31.89:80"
def test_forward(speed=25):
response = requests.get(f"{BASE_URL}/forward?speed={speed}")
print(f"Forward: {response.status_code}, {response.text}")
def test_backward(speed=25):
response = requests.get(f"{BASE_URL}/backward?speed={speed}")
print(f"Backward: {response.status_code}, {response.text}")
def test_perform_drift(direction='right'):
response = requests.get(f"{BASE_URL}/perform_drift?direction={direction}")
print(f"Perform Drift: {response.status_code}, {response.text}")
def test_get_performance_stats():
response = requests.get(f"{BASE_URL}/get_performance_stats")
print(f"Get Performance Stats: {response.status_code}, {response.text}")
def test_turn_left(angle=45):
response = requests.get(f"{BASE_URL}/turn_left?angle={angle}")
print(f"Turn Left: {response.status_code}, {response.text}")
def test_turn_right(angle=45):
response = requests.get(f"{BASE_URL}/turn_right?angle={angle}")
print(f"Turn Right: {response.status_code}, {response.text}")
def test_stop():
response = requests.get(f"{BASE_URL}/stop")
print(f"Stop: {response.status_code}, {response.text}")
def test_emergency_stop():
response = requests.get(f"{BASE_URL}/emergency_stop")
print(f"Emergency Stop: {response.status_code}, {response.text}")
def test_status():
response = requests.get(f"{BASE_URL}/status")
print(f"Status: {response.status_code}, {response.text}")
if __name__ == "__main__":
test_forward()
test_backward()
# test_perform_drift()
test_get_performance_stats()
test_turn_left()
test_turn_right()
test_stop()
test_emergency_stop()
test_status()