def test_single_post_bad_data(json_client, cheetah_mock): response = json_client.post("/api/v1/animals/cheetahs/1", {"name": "Kyle", "age": 22}) assert response.status_code == 405 assert response.content == "" assert not cheetah_mock["create"].called
def test_multiple_post_happy(json_client, cheetah_mock): response = json_client.post("/api/v1/animals/cheetahs", {"name": "Kyle", "age": 34}) assert response.status_code == 201 cheetah_mock["create"].assert_called_once_with(name="Kyle", age=34)
def test_multiple_post_bad_data(json_client, cheetah_mock): response = json_client.post("/api/v1/animals/cheetahs", {"name": "Kyle"}) assert response.status_code == 400 assert response.content == "Missing required key: age" assert not cheetah_mock["create"].called