import json def test_post_with_wrong_content_type(client): data = json.dumps({}) response = client.post("/", data=data) assert response.status_code == 415 def test_post_with_empty_data(client): data = json.dumps({}) response = client.post("/", data=data, content_type="application/json") assert response.status_code == 400 def test_post_with_data(client): data = json.dumps({"key": "abc", "val": "def"}) response = client.post("/", data=data, content_type="application/json") assert response.status_code == 201 assert response.get_json() == { "message": "Ok", "data": {"key": "abc", "val": "def"}, }