FT fix CI #340: re-seed Earthman deck in GameboardNavigationTest setUp — TransactionTestCase flush trap
`test_game_kit_panel_shows_token_inventory` (a133a9c's polish-9 FT fix) was looking for `id_kit_earthman_deck` in the Game Kit applet. CI #340 surfaced that the selector wasn't rendering — same `TransactionTestCase` migration-seed flush trap documented in `feedback_transactiontestcase_flush.md`: 1. `LiveServerTestCase` derives from `TransactionTestCase` → DB flushed between tests → migration-seeded `DeckVariant(slug="earthman")` row vanishes. 2. `apps/lyric/models.py:537`'s `DeckVariant.objects.filter(slug="earthman").first()` returns None in the post_save signal → `unlocked_decks.add(earthman)` silently skipped. 3. Gameboard view passes `request.user.unlocked_decks.all()` as `deck_variants` → empty → applet partial falls through to `{% empty %}` `id_kit_card_deck` placeholder instead of the per-deck `id_kit_{{ deck.short_key }}_deck` element the FT expects. Fix mirrors the 14+ other FTs already using this helper: call `_seed_earthman_sig_pile()` in `setUp` before `create_pre_authenticated_session` fires the signal. The helper is `get_or_create`-based + idempotent. Selector itself was NOT renamed — `short_key = slug.split('-')[0]` still yields `"earthman"` from slug `"earthman"`, so `id_kit_earthman_deck` is correct. Verified locally: the test runs green w. the seed call in place. Pre-existing in `git status`, bundled per project commit-everything rule: - `src/.coveragerc` — add `*/delete_stale_my_sea_draws.py` to coverage omit list (one-off management script doesn't need coverage measurement) 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:
@@ -5,6 +5,7 @@ omit =
|
||||
*/tests/*
|
||||
*/routing.py
|
||||
*/reset_staging_db.py
|
||||
*/delete_stale_my_sea_draws.py
|
||||
|
||||
[report]
|
||||
show_missing = true
|
||||
@@ -3,6 +3,7 @@ from selenium.webdriver.common.action_chains import ActionChains
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from .base import FunctionalTest
|
||||
from .sig_page import _seed_earthman_sig_pile
|
||||
from apps.applets.models import Applet
|
||||
from apps.epic.models import DeckVariant, Room
|
||||
from apps.lyric.models import Token, User
|
||||
@@ -11,6 +12,17 @@ from apps.lyric.models import Token, User
|
||||
class GameboardNavigationTest(FunctionalTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
# Re-seed the Earthman DeckVariant up front — TransactionTestCase
|
||||
# flushes migration data between tests, so by the time the user
|
||||
# is created (`create_pre_authenticated_session` inside each test
|
||||
# method), the post_save signal in `apps/lyric/models.py:537`'s
|
||||
# `DeckVariant.objects.filter(slug="earthman").first()` would
|
||||
# return None + skip `unlocked_decks.add(earthman)`. That left
|
||||
# `test_game_kit_panel_shows_token_inventory`'s `id_kit_earthman_
|
||||
# deck` selector unrenderable (applet falls through to the
|
||||
# `{% empty %}` `id_kit_card_deck` placeholder). CI #340 trap.
|
||||
# See [[feedback-transactiontestcase-flush]].
|
||||
_seed_earthman_sig_pile()
|
||||
Applet.objects.get_or_create(slug="new-game", defaults={"name": "New Game", "context": "gameboard"})
|
||||
Applet.objects.get_or_create(slug="my-games", defaults={"name": "My Games", "context": "gameboard"})
|
||||
Applet.objects.get_or_create(slug="game-kit", defaults={"name": "Game Kit", "context": "gameboard"})
|
||||
|
||||
Reference in New Issue
Block a user