Skip to content

Commit bfdd4d9

Browse files
committed
test: filter list assertions by base_model so fixtures survive real data
test_list_laptops/test_list_monitors asserted the fixture appeared in the unpaginated first page — which breaks once real laptop/monitor data fills the list (the fixture is buried past page 1). Filter by the fixture's unique base_model_slug instead. (Latent since the laptop data merged; surfaced by this PR running pytest against the full dataset.)
1 parent c906d9e commit bfdd4d9

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

tests/integration/test_laptops.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ def test_list_laptops(client: TestClient) -> None:
1111
ensure_laptop_fixtures()
1212
body = client.get("/v1/laptops").json()
1313
assert body["count"] >= 1
14-
slugs = {r["slug"] for r in body["results"]}
14+
# Filter by the fixture's unique base model so it is not buried under real
15+
# laptop data in pagination.
16+
filtered = client.get("/v1/laptops?base_model_slug=legion-pro-5").json()
17+
slugs = {r["slug"] for r in filtered["results"]}
1518
assert "lenovo-legion-pro-5-test" in slugs
1619

1720

tests/integration/test_monitors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ def test_list_monitors(client: TestClient) -> None:
1111
ensure_monitor_fixtures()
1212
body = client.get("/v1/monitors").json()
1313
assert body["count"] >= 1
14-
slugs = {r["slug"] for r in body["results"]}
14+
# Filter by the fixture's unique base model so it is not buried under real
15+
# monitor data in pagination.
16+
filtered = client.get("/v1/monitors?base_model_slug=lg-ultragear-27gp850").json()
17+
slugs = {r["slug"] for r in filtered["results"]}
1518
assert "lg-ultragear-27gp850-test" in slugs
1619

1720

0 commit comments

Comments
 (0)