|
11 | 11 |
|
12 | 12 |
|
13 | 13 | def test_dump_writes_list_detail_and_manifest(client: TestClient, tmp_path: Path) -> None: |
14 | | - counts = generate(client, output_dir=tmp_path) |
15 | | - assert counts["smartphones"] >= 10 |
16 | | - assert counts["gpus"] >= 1 |
17 | | - assert counts["cpus"] >= 1 |
| 14 | + collections = ["tablets", "watches", "pdas"] |
| 15 | + counts = generate(client, output_dir=tmp_path, collections=collections) |
| 16 | + assert counts["tablets"] >= 1 |
| 17 | + assert counts["watches"] >= 1 |
| 18 | + assert counts["pdas"] >= 1 |
18 | 19 |
|
19 | 20 | # Detail file matches the live API response. |
20 | | - detail_file = tmp_path / "v1" / "smartphones" / "galaxy-s25" / "index.json" |
| 21 | + detail_file = tmp_path / "v1" / "tablets" / "ipad-pro-11-m4-wifi-8gb-256gb" / "index.json" |
21 | 22 | assert detail_file.exists() |
22 | 23 | detail = json.loads(detail_file.read_text()) |
23 | | - assert detail["slug"] == "galaxy-s25" |
24 | | - assert detail == client.get("/v1/smartphones/galaxy-s25").json() |
25 | | - |
26 | | - # Score sidecar is dumped for smartphones. |
27 | | - assert (tmp_path / "v1" / "smartphones" / "galaxy-s25" / "score" / "index.json").exists() |
| 24 | + assert detail["slug"] == "ipad-pro-11-m4-wifi-8gb-256gb" |
| 25 | + assert detail == client.get("/v1/tablets/ipad-pro-11-m4-wifi-8gb-256gb").json() |
28 | 26 |
|
29 | 27 | # Combined list file holds every item. |
30 | | - listing = json.loads((tmp_path / "v1" / "smartphones" / "index.json").read_text()) |
| 28 | + listing = json.loads((tmp_path / "v1" / "tablets" / "index.json").read_text()) |
31 | 29 | assert listing["count"] == len(listing["results"]) |
32 | 30 |
|
33 | 31 | # Manifest enumerates all collections. |
34 | 32 | manifest = json.loads((tmp_path / "v1" / "index.json").read_text()) |
35 | | - assert {"brands", "socs", "smartphones", "gpus", "cpus"} <= manifest["collections"].keys() |
| 33 | + assert set(manifest["collections"].keys()) == set(collections) |
0 commit comments