From c399afa26d846a22b16f04324defa48ffe01b824 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Tue, 28 Apr 2026 11:46:47 -0400 Subject: [PATCH] =?UTF-8?q?role=20select=20channels=20FTs:=20get=5For=5Fcr?= =?UTF-8?q?eate=20DeckVariant=20in=20=5Fequip=5Fearthman=5Fdeck=20?= =?UTF-8?q?=E2=80=94=20fixes=20CI=20flush=20wipe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TransactionTestCase.flush() wipes all rows (incl. migration-seeded DeckVariants) after every test. Landscape runs first (alphabetically), consumes the seeded deck, then flush removes it. Subsequent tests called filter().first() → None → silently skipped → data-equipped-deck="" → JS no-deck warning instead of opening fan. Code architected by Disco DeDisco Git commit message Co-Authored-By: Claude Sonnet 4.6 --- src/functional_tests/test_room_role_select.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/functional_tests/test_room_role_select.py b/src/functional_tests/test_room_role_select.py index 701c5ff..f03624e 100644 --- a/src/functional_tests/test_room_role_select.py +++ b/src/functional_tests/test_room_role_select.py @@ -14,11 +14,14 @@ from apps.lyric.models import User def _equip_earthman_deck(user): - """Equip the Earthman DeckVariant so the role-select no-deck guard passes.""" - deck = DeckVariant.objects.filter(name__icontains="Earthman").first() - if deck: - user.equipped_deck = deck - user.save(update_fields=["equipped_deck"]) + # get_or_create: TransactionTestCase.flush() wipes migration-seeded DeckVariants + # between tests, so subsequent tests in the same run can't find it via filter(). + deck, _ = DeckVariant.objects.get_or_create( + slug="earthman", + defaults={"name": "Earthman", "card_count": 106, "is_default": True}, + ) + user.equipped_deck = deck + user.save(update_fields=["equipped_deck"]) def _fill_room_via_orm(room, emails):