|
1 | 1 | """example/tests/test_endpoints.py""" |
2 | 2 |
|
3 | 3 |
|
4 | | -def test_root_path(coverage_client): |
| 4 | +def test_root_path(client): |
5 | 5 | """Test the root endpoint.""" |
6 | | - response = coverage_client.get("/") |
| 6 | + response = client.get("/") |
7 | 7 | assert response.status_code == 200 |
8 | 8 | assert response.json() == {"message": "Hello World"} |
9 | 9 |
|
10 | 10 |
|
11 | | -def test_items_path(coverage_client): |
| 11 | +def test_items_path(client): |
12 | 12 | """Test the items endpoint.""" |
13 | | - response = coverage_client.get("/items/42") |
| 13 | + response = client.get("/items/42") |
14 | 14 | assert response.status_code == 200 |
15 | 15 | assert response.json() == {"item_id": 42} |
16 | 16 |
|
17 | 17 |
|
18 | | -def test_create_item(coverage_client): |
| 18 | +def test_create_item(client): |
19 | 19 | """Test creating an item.""" |
20 | | - response = coverage_client.post("/items", json={"name": "test item"}) |
| 20 | + response = client.post("/items", json={"name": "test item"}) |
21 | 21 | assert response.status_code == 200 |
22 | 22 | assert response.json()["message"] == "Item created" |
23 | 23 |
|
24 | 24 |
|
25 | | -def test_xyz_and_root_path(coverage_client): |
| 25 | +def test_xyz_and_root_path(client): |
26 | 26 | """Test the xyz endpoint.""" |
27 | | - response = coverage_client.get("/xyz/123") |
| 27 | + response = client.get("/xyz/123") |
28 | 28 | assert response.status_code == 404 |
29 | | - response = coverage_client.get("/xyzzyx") |
| 29 | + response = client.get("/xyzzyx") |
30 | 30 | assert response.status_code == 200 |
31 | | - response = coverage_client.get("/") |
| 31 | + response = client.get("/") |
32 | 32 | assert response.status_code == 200 |
33 | 33 | assert response.json() == {"message": "Hello World"} |
0 commit comments