From 2b39594ba5202a2a280b35d3f93ddc07aee7417c Mon Sep 17 00:00:00 2001 From: Zyzf Date: Fri, 19 May 2023 15:31:05 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..e61604b --- /dev/null +++ b/test.py @@ -0,0 +1,31 @@ +import json +import requests + +urls = ["client", "driver", "pickUpPoint", "car", "order"] + +for name in urls: + x = json.loads(requests.get(f'http://localhost:8081/{name}').content.decode('utf-8')) + for el in x: + if (name == "car"): + el["driverId"] = el["driver"]["id"]; + y = requests.post(f'http://localhost:8080/{name}WithId', json = el) + if (y.status_code == 200): + print("ok") + else: + print("error") + elif (name == "order"): + el["carId"] = el["car"]["id"]; + el["clientId"] = el["client"]["id"]; + el["sourcePickUpPointId"] = el["sourcePickUpPoint"]["id"]; + el["destPickUpPointId"] = el["destPickUpPoint"]["id"]; + y = requests.post(f'http://localhost:8080/{name}WithId', json = el) + if (y.status_code == 200): + print("ok") + else: + print("error") + else: + y = requests.post(f'http://localhost:8080/{name}WithId', json = el) + if (y.status_code == 200): + print("ok") + else: + print("error")