Files
python-tdd/src/apps/drama/tests/unit/test_models.py

51 lines
2.1 KiB
Python
Raw Normal View History

Baltimorean Note unlock loop — full UX from bawlmorese pronoun pick → Brief banner → DON → palette modal → dashboard swatch ; rootvars.scss adds the Baltimorean (Blt) hue family (red 200,16,46 / yellow 255,212,0 / white 255,255,255 / black 0,0,0 / purple 26,25,95 / orange 221,73,38 — Maryland-flag-derived plus a `--sixBlt: 162,170,173` neutral) + two `.palette-baltimore` / `.palette-maryland` palette classes wiring those hues into the standard `--priUser`…`--decUser` slots; companion section-header rename "/* X Palette */" → "/* X Hues */" across rootvars to disambiguate raw hue families (Precious Metal / Cosmic Metal / Chroma / Earthman / Technoman / Inferno) from actual palette classes — section-comment-only, no rule-level change ; baltimorean entry added in 3 registries that drive the loop: `_NOTE_DISPLAY` (drama/models.py) — `{"greeting": "Ayo,", "title": "Ard!"}` so DON flips navbar `Welcome, Earthman` → `Ayo, Ard!`; `_NOTE_TITLES` (dashboard/views.py, user-pre-staged) — drives the "recognized via Baltimorean" copy on dashboard palette swatches; `_NOTE_META` (billboard/views.py) — Baltimorean title + the literal description `"Aaron earned an iron urn."` + palette_options [palette-baltimore, palette-maryland] feeding the my-notes swatch modal ; `set_pronouns` view rewired (dashboard/views.py) — first-time `pronouns = bawlmorese` selection calls `Note.grant_if_new(user, "baltimorean")` + returns `{"brief": brief.to_banner_dict()}` JSON @ 200; idempotent on repeat (the grant_if_new returns brief=None on second call so the 204 path resumes naturally); non-bawlmorese choices stay on the original 204 contract ; client wiring: game-kit.js pronouns `commit()` handles the 200 JSON path — `resp.json().then(data => Brief.showBanner(data.brief))` instead of reload (reload would lose the just-fired banner); 204 still reloads to update active pronoun card; `game_kit.html` pulls in `apps/dashboard/note.js` so `Brief` is in scope on the Game Kit page (it wasn't before) ; Brief banner placement fix — `note.js showBanner()` now measures the `.row .col-lg-6 h2` at render-time + sets inline `top` so the banner portals SQUARELY OVER the page h2 letter-spread wordmark instead of parking at the SCSS-default `top: 0.5rem` (which had it lurking above the wordmark area on every page); portrait-only (gated `if window.innerWidth > window.innerHeight return`) — landscape h2 lives in a `writing-mode: vertical-rl` fixed sidebar column + would need a full banner reorientation (writing-mode + flex-direction restyle of banner contents) to "overlay" sensibly, deferred to a follow-up sprint ; tests: drama/tests/unit/test_models.py (new file) — 5 UTs for `_NOTE_DISPLAY[baltimorean]` greeting/title/name + stargazer smoke tests; dashboard/tests/integrated/test_views.py — `SetPronounsBawlmoreseUnlockTest` (9 ITs covering first-bawlmorese-returns-200-w-brief / Note granted / title `Ard!` / square_url to /billboard/my-notes/ / idempotent on repeat / non-bawlmorese unaffected / bawlmorese-after-other still grants); existing `SetPronounsViewTest.test_post_each_valid_choice` docstring updated to flag the bawlmorese 200 branch ; functional_tests/test_bill_baltimorean.py (new file) — 6 FTs walking the full UX: T1 Game-Kit pronouns click → Brief banner w. `Ard!` title + Look! prose + ?-square + FYI nav; T2 idempotent repeat-click (no re-fire); T3 my-notes Baltimorean item carries the Aaron quote verbatim; T4 DON flips navbar greeting `Welcome, Earthman` → `Ayo, Ard!`; T5 palette modal offers Baltimore + Maryland swatches (and not Bardo/Sheol); T6 Baltimore swatch click previews → OK commits → dashboard Palette applet shows the swatch unlocked w. `data-description` carrying `Baltimorean` + non-empty `data-unlocked-date` + Note.palette = palette-baltimore in DB — all 6 green in 51s; full IT/UT sweep 997 → green in 45s — TDD Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 02:17:07 -04:00
from django.test import SimpleTestCase
from apps.drama.models import Note
def _note(slug):
n = Note()
n.slug = slug
return n
class NoteDisplayBaltimoreanTest(SimpleTestCase):
"""`_NOTE_DISPLAY['baltimorean']` — greeting/title combo "Ayo, Ard!" replaces
"Welcome, Earthman" once the user dons the Baltimorean Note (unlocked by
first-time `pronouns = bawlmorese` selection)."""
def test_baltimorean_display_title_is_ard(self):
self.assertEqual(_note("baltimorean").display_title, "Ard!")
def test_baltimorean_display_greeting_is_ayo(self):
self.assertEqual(_note("baltimorean").display_greeting, "Ayo,")
def test_baltimorean_display_name_is_baltimorean(self):
"""The my-notes heading label — `.title()` of the slug recovers the
proper rendering for any slug without a `name` override in
`_NOTE_DISPLAY`. Baltimorean has no override, so this should fall
through to `slug.title()` 'Baltimorean'."""
self.assertEqual(_note("baltimorean").display_name, "Baltimorean")
Baltimorean "Ard!" → "Baltimorean" rename across inline surfaces (banner / scroll line / my-notes Title row); navbar DON greeting keeps "Ayo, Ard!" as the sole Ard! flair — and a companion PronounsAppletFlowTest sync-point fix for the 200/Brief response path introduced by the Baltimorean unlock loop in 435a192 ; FT fix (functional_tests/test_game_kit.py) — `PronounsAppletFlowTest.test_pronoun_flip_propagates_to_billscroll_and_most_recent` was written pre-Baltimorean when `set_pronouns` always returned 204 → reload; the Baltimorean loop split the response into 200-w-brief (first-bawlmorese, no reload — Brief banner would be lost) vs 204-reload (other pronouns), so the test's step-4 `wait_for(.gk-pronoun-card.active[data-pronoun='bawlmorese'])` hung indefinitely on the Brief banner because the active class only updates after the reload that no longer happens; sync point swapped to `wait_for(.note-banner)` — the Brief banner's appearance is the natural post-commit signal that the server saved the pronoun (after which step-5/6 navigate to billboard + scroll to verify "yos" prose) ; rename core (drama/models.py) — `Note.grant_if_new` else branch's `attr_combo` inline attribution now uses `note.display_name` instead of `note.display_title`, so the scroll line reads "Look!—new Note unlocked. Baltimorean recognizes @disco the Baltimorean." instead of "…the Ard!." (for stargazer/schizo/nomad display_name == display_title so the line is unchanged; only baltimorean's two values diverge — display_title="Ard!" for navbar flair, display_name="Baltimorean" for everywhere else); `Brief.title` field also swapped from `display_title` to `display_name` so the banner title slot reads "Baltimorean" not "Ard!" — admin-grant branch (_ADMIN_NOTE_SLUGS: super-schizo, super-nomad) still uses `display_title` for the "honorary title of {X}" phrase because that branch DOES want the don-able title there ("Schizoid Man" / "Stranger") ; my-notes card "Title:" row rename — added `card_title` key to `_NOTE_DISPLAY["baltimorean"]` (`{"greeting": "Ayo,", "title": "Ard!", "card_title": "Baltimorean"}`) + new `Note.card_title` property that falls through `_NOTE_DISPLAY[slug]["card_title"]` then defaults to `display_title`; billboard/views.py `_my_notes_context` swaps `"recognition_title": n.display_title` → `n.card_title` so the my-notes Baltimorean card shows "Title: Baltimorean" instead of "Title: Ard!" — super-schizo's card still reads "Title: Schizoid Man" because card_title falls back to display_title for slugs w.o an override ; ONLY Ard! surface remaining: navbar DON greeting via `User.active_title.display_title` (lyric/models.py:158) — `display_title` itself was deliberately untouched so the navbar still flips `Welcome, Earthman` → `Ayo, Ard!` after DON, which is the entire point of the Baltimorean flair ; existing DB rows w. stored "the Ard!" `Line.text` + `Brief.title="Ard!"` from prior dev-DB grants will NOT update — those columns are persisted at `grant_if_new` time, not computed live; user has accepted dev-DB wipe-and-re-acquire as the path forward, so no data migration ; tests — drama/tests/unit/test_models.py +2 UTs (`test_baltimorean_card_title_is_baltimorean` pins the override, `test_stargazer_card_title_falls_back_to_display_title` pins the fallback for non-overridden slugs); drama/tests/integrated/test_note_brief.py `test_first_grant_creates_post_line_and_brief` updated assertion `brief.title == note.display_name` (was `display_title`) to reflect the new contract; dashboard/tests/integrated/test_views.py `test_brief_payload_carries_baltimorean_title` expects "Baltimorean" not "Ard!"; functional_tests/test_bill_baltimorean.py T1 banner title check swapped "Ard!" → "Baltimorean" + module docstring line 10 updated — T4 (navbar DON greeting flip to "Ayo, Ard!") preserved verbatim, the one surface where Ard! still lives ; full FT suite for baltimorean 6/6 green in 53s; drama + dashboard + billboard ITs/UTs 290 green in 16.5s — TDD Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 10:54:30 -04:00
def test_baltimorean_card_title_is_baltimorean(self):
"""The my-notes card's "Title:" row uses `card_title`, which Baltimorean
explicitly overrides to "Baltimorean" so the navbar-only "Ard!" flair
doesn't leak onto the card."""
self.assertEqual(_note("baltimorean").card_title, "Baltimorean")
Baltimorean Note unlock loop — full UX from bawlmorese pronoun pick → Brief banner → DON → palette modal → dashboard swatch ; rootvars.scss adds the Baltimorean (Blt) hue family (red 200,16,46 / yellow 255,212,0 / white 255,255,255 / black 0,0,0 / purple 26,25,95 / orange 221,73,38 — Maryland-flag-derived plus a `--sixBlt: 162,170,173` neutral) + two `.palette-baltimore` / `.palette-maryland` palette classes wiring those hues into the standard `--priUser`…`--decUser` slots; companion section-header rename "/* X Palette */" → "/* X Hues */" across rootvars to disambiguate raw hue families (Precious Metal / Cosmic Metal / Chroma / Earthman / Technoman / Inferno) from actual palette classes — section-comment-only, no rule-level change ; baltimorean entry added in 3 registries that drive the loop: `_NOTE_DISPLAY` (drama/models.py) — `{"greeting": "Ayo,", "title": "Ard!"}` so DON flips navbar `Welcome, Earthman` → `Ayo, Ard!`; `_NOTE_TITLES` (dashboard/views.py, user-pre-staged) — drives the "recognized via Baltimorean" copy on dashboard palette swatches; `_NOTE_META` (billboard/views.py) — Baltimorean title + the literal description `"Aaron earned an iron urn."` + palette_options [palette-baltimore, palette-maryland] feeding the my-notes swatch modal ; `set_pronouns` view rewired (dashboard/views.py) — first-time `pronouns = bawlmorese` selection calls `Note.grant_if_new(user, "baltimorean")` + returns `{"brief": brief.to_banner_dict()}` JSON @ 200; idempotent on repeat (the grant_if_new returns brief=None on second call so the 204 path resumes naturally); non-bawlmorese choices stay on the original 204 contract ; client wiring: game-kit.js pronouns `commit()` handles the 200 JSON path — `resp.json().then(data => Brief.showBanner(data.brief))` instead of reload (reload would lose the just-fired banner); 204 still reloads to update active pronoun card; `game_kit.html` pulls in `apps/dashboard/note.js` so `Brief` is in scope on the Game Kit page (it wasn't before) ; Brief banner placement fix — `note.js showBanner()` now measures the `.row .col-lg-6 h2` at render-time + sets inline `top` so the banner portals SQUARELY OVER the page h2 letter-spread wordmark instead of parking at the SCSS-default `top: 0.5rem` (which had it lurking above the wordmark area on every page); portrait-only (gated `if window.innerWidth > window.innerHeight return`) — landscape h2 lives in a `writing-mode: vertical-rl` fixed sidebar column + would need a full banner reorientation (writing-mode + flex-direction restyle of banner contents) to "overlay" sensibly, deferred to a follow-up sprint ; tests: drama/tests/unit/test_models.py (new file) — 5 UTs for `_NOTE_DISPLAY[baltimorean]` greeting/title/name + stargazer smoke tests; dashboard/tests/integrated/test_views.py — `SetPronounsBawlmoreseUnlockTest` (9 ITs covering first-bawlmorese-returns-200-w-brief / Note granted / title `Ard!` / square_url to /billboard/my-notes/ / idempotent on repeat / non-bawlmorese unaffected / bawlmorese-after-other still grants); existing `SetPronounsViewTest.test_post_each_valid_choice` docstring updated to flag the bawlmorese 200 branch ; functional_tests/test_bill_baltimorean.py (new file) — 6 FTs walking the full UX: T1 Game-Kit pronouns click → Brief banner w. `Ard!` title + Look! prose + ?-square + FYI nav; T2 idempotent repeat-click (no re-fire); T3 my-notes Baltimorean item carries the Aaron quote verbatim; T4 DON flips navbar greeting `Welcome, Earthman` → `Ayo, Ard!`; T5 palette modal offers Baltimore + Maryland swatches (and not Bardo/Sheol); T6 Baltimore swatch click previews → OK commits → dashboard Palette applet shows the swatch unlocked w. `data-description` carrying `Baltimorean` + non-empty `data-unlocked-date` + Note.palette = palette-baltimore in DB — all 6 green in 51s; full IT/UT sweep 997 → green in 45s — TDD Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 02:17:07 -04:00
class NoteDisplayStargazerTest(SimpleTestCase):
"""Smoke tests for the existing stargazer entry — pins the contract that
new entries follow."""
def test_stargazer_display_title_is_stargazer(self):
self.assertEqual(_note("stargazer").display_title, "Stargazer")
def test_stargazer_display_greeting_is_welcome(self):
self.assertEqual(_note("stargazer").display_greeting, "Welcome,")
Baltimorean "Ard!" → "Baltimorean" rename across inline surfaces (banner / scroll line / my-notes Title row); navbar DON greeting keeps "Ayo, Ard!" as the sole Ard! flair — and a companion PronounsAppletFlowTest sync-point fix for the 200/Brief response path introduced by the Baltimorean unlock loop in 435a192 ; FT fix (functional_tests/test_game_kit.py) — `PronounsAppletFlowTest.test_pronoun_flip_propagates_to_billscroll_and_most_recent` was written pre-Baltimorean when `set_pronouns` always returned 204 → reload; the Baltimorean loop split the response into 200-w-brief (first-bawlmorese, no reload — Brief banner would be lost) vs 204-reload (other pronouns), so the test's step-4 `wait_for(.gk-pronoun-card.active[data-pronoun='bawlmorese'])` hung indefinitely on the Brief banner because the active class only updates after the reload that no longer happens; sync point swapped to `wait_for(.note-banner)` — the Brief banner's appearance is the natural post-commit signal that the server saved the pronoun (after which step-5/6 navigate to billboard + scroll to verify "yos" prose) ; rename core (drama/models.py) — `Note.grant_if_new` else branch's `attr_combo` inline attribution now uses `note.display_name` instead of `note.display_title`, so the scroll line reads "Look!—new Note unlocked. Baltimorean recognizes @disco the Baltimorean." instead of "…the Ard!." (for stargazer/schizo/nomad display_name == display_title so the line is unchanged; only baltimorean's two values diverge — display_title="Ard!" for navbar flair, display_name="Baltimorean" for everywhere else); `Brief.title` field also swapped from `display_title` to `display_name` so the banner title slot reads "Baltimorean" not "Ard!" — admin-grant branch (_ADMIN_NOTE_SLUGS: super-schizo, super-nomad) still uses `display_title` for the "honorary title of {X}" phrase because that branch DOES want the don-able title there ("Schizoid Man" / "Stranger") ; my-notes card "Title:" row rename — added `card_title` key to `_NOTE_DISPLAY["baltimorean"]` (`{"greeting": "Ayo,", "title": "Ard!", "card_title": "Baltimorean"}`) + new `Note.card_title` property that falls through `_NOTE_DISPLAY[slug]["card_title"]` then defaults to `display_title`; billboard/views.py `_my_notes_context` swaps `"recognition_title": n.display_title` → `n.card_title` so the my-notes Baltimorean card shows "Title: Baltimorean" instead of "Title: Ard!" — super-schizo's card still reads "Title: Schizoid Man" because card_title falls back to display_title for slugs w.o an override ; ONLY Ard! surface remaining: navbar DON greeting via `User.active_title.display_title` (lyric/models.py:158) — `display_title` itself was deliberately untouched so the navbar still flips `Welcome, Earthman` → `Ayo, Ard!` after DON, which is the entire point of the Baltimorean flair ; existing DB rows w. stored "the Ard!" `Line.text` + `Brief.title="Ard!"` from prior dev-DB grants will NOT update — those columns are persisted at `grant_if_new` time, not computed live; user has accepted dev-DB wipe-and-re-acquire as the path forward, so no data migration ; tests — drama/tests/unit/test_models.py +2 UTs (`test_baltimorean_card_title_is_baltimorean` pins the override, `test_stargazer_card_title_falls_back_to_display_title` pins the fallback for non-overridden slugs); drama/tests/integrated/test_note_brief.py `test_first_grant_creates_post_line_and_brief` updated assertion `brief.title == note.display_name` (was `display_title`) to reflect the new contract; dashboard/tests/integrated/test_views.py `test_brief_payload_carries_baltimorean_title` expects "Baltimorean" not "Ard!"; functional_tests/test_bill_baltimorean.py T1 banner title check swapped "Ard!" → "Baltimorean" + module docstring line 10 updated — T4 (navbar DON greeting flip to "Ayo, Ard!") preserved verbatim, the one surface where Ard! still lives ; full FT suite for baltimorean 6/6 green in 53s; drama + dashboard + billboard ITs/UTs 290 green in 16.5s — TDD Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 10:54:30 -04:00
def test_stargazer_card_title_falls_back_to_display_title(self):
"""Slugs without a `card_title` override fall through to display_title —
for stargazer that's "Stargazer" (don-able title == Note name)."""
self.assertEqual(_note("stargazer").card_title, "Stargazer")