aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_api_get.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_api_get.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_api_get.py b/tests/test_api_get.py
index e69de29..1e900a8 100644
--- a/tests/test_api_get.py
+++ b/tests/test_api_get.py
@@ -0,0 +1,22 @@
+import requests
+
+BASE = "https://jsonplaceholder.typicode.com"
+
+def test_get_users_status_200():
+ r = requests.get(f"{BASE}/users")
+ assert r.status_code == 200
+
+def test_get_users_has_data():
+ r = requests.get(f"{BASE}/users")
+ body = r.json()
+ assert isinstance(body, list)
+ assert len(body) > 0
+
+def test_get_single_user_status_200():
+ r = requests.get(f"{BASE}/users/1")
+ assert r.status_code == 200
+ assert r.json()["id"] == 1
+
+def test_get_single_user_not_found():
+ r = requests.get(f"{BASE}/users/9999")
+ assert r.status_code == 404