aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_api_edge.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_edge.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_edge.py')
-rw-r--r--tests/test_api_edge.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_api_edge.py b/tests/test_api_edge.py
index e69de29..f663834 100644
--- a/tests/test_api_edge.py
+++ b/tests/test_api_edge.py
@@ -0,0 +1,24 @@
+import requests
+
+BASE = "https://jsonplaceholder.typicode.com"
+
+def test_get_posts_filter_by_userid():
+ r = requests.get(f"{BASE}/posts?userId=1")
+ assert r.status_code == 200
+ for post in r.json():
+ assert post["userId"] == 1
+
+def test_patch_post_partial_update():
+ payload = {"title": "updated by qa"}
+ r = requests.patch(f"{BASE}/posts/1", json=payload)
+ assert r.status_code == 200
+ assert r.json()["title"] == "updated by qa"
+
+def test_delete_post_status_200():
+ r = requests.delete(f"{BASE}/posts/1")
+ assert r.status_code == 200
+
+def test_get_comments_by_postid():
+ r = requests.get(f"{BASE}/comments?postId=1")
+ assert r.status_code == 200
+ assert len(r.json()) > 0