role select channels FTs: get_or_create DeckVariant in _equip_earthman_deck — fixes CI flush wipe
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 <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user