From 6796584928477601cbbceecdb6fb48834eaba5cd Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Fri, 26 Jun 2026 20:56:28 +0300 Subject: [PATCH] test: lock that the deck list omits cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #30 split the Deck response contract (light Deck for lists, DeckWithCards for detail) but no test asserted that cards is absent from list responses — the existing tests passed either way. Add a test that creates a deck WITH a card and asserts the list item has no cards key. Under the old single-schema design this would have failed (it returned the misleading cards: []), so it pins the fix. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_decks.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_decks.py b/tests/test_decks.py index 143fbb0..fa5968d 100644 --- a/tests/test_decks.py +++ b/tests/test_decks.py @@ -35,6 +35,16 @@ async def test_get_decks(client: AsyncClient) -> None: assert v == getattr(deck, k) +async def test_list_decks_omits_cards(client: AsyncClient) -> None: + deck = await factories.DeckModelFactory.create_async() + await factories.CardModelFactory.create_async(deck_id=deck.id) + + response = await client.get("/api/decks/") + assert response.status_code == status_codes.HTTP_200_OK + item = response.json()["items"][0] + assert "cards" not in item + + async def test_get_one_deck(client: AsyncClient) -> None: deck = await factories.DeckModelFactory.create_async() card = await factories.CardModelFactory.create_async(deck_id=deck.id)