aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_api_get.py
diff options
context:
space:
mode:
authorpack <pack@packgekko.xyz>2026-06-08 13:47:19 +0000
committerpack <pack@packgekko.xyz>2026-06-08 13:47:19 +0000
commit3a4e30b6e01f075d880957fde056d52ec3a82c15 (patch)
tree501daa604a7726974257445ff4a5b17e1057ebf7 /tests/test_api_get.py
parent440d760882a27a3bc110dacaad92b6cfb29b5d7a (diff)
downloadqa_automation_bootcamp-3a4e30b6e01f075d880957fde056d52ec3a82c15.tar.gz
add 10 API tests against jsonplaceholder.typicode.com, get post, edge cases
Diffstat (limited to 'tests/test_api_get.py')
-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