def test_singular_put(json_client, cheetah_mock): response = json_client.put("/api/v1/animals/cheetahs/1", {"name": "Kyle", "age": 34}) assert response.status_code == 200 cheetah_mock["filter"].assert_called_once_with(id=1) cheetah_mock["queryset"].update.assert_called_once_with(name="Kyle", age=34)
def test_singular_put_bad_id(json_client, cheetah_mock_bad_ids): response = json_client.put("/api/v1/animals/cheetahs/2", {"name": "Kyle", "age": 34}) assert response.status_code == 404 assert not cheetah_mock_bad_ids["queryset"].update.called