diff options
Diffstat (limited to 'tests/test_api_edge.py')
| -rw-r--r-- | tests/test_api_edge.py | 24 |
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 |