SIG SELECT: Nomad/Schizo locked by default; Note-unlock gate — TDD
- _filter_major_unlocks(cards, user): strips Major 0 (Nomad) and Major 1 (Schizo) unless user has matching 'nomad'/'schizo' Note; unauthenticated users see 0 majors - levity_sig_cards(room, user) / gravity_sig_cards(room, user): accept user param; default 16 court cards, up to 18 with both Note unlocks - View wires user into both calls; _sig_unique_cards / sig_deck_cards unchanged (game-table deck still includes all 18 unique) - _full_sig_setUp: seats now carry deck_variant=earthman - SigCardHelperTest: 4 new ITs (default 16, nomad +1, schizo +1); empty-deck test updated to clear seats + owner - SigSelectRenderingTest: 18-card test updated to 16-default + 3 Note-unlock ITs Pending: superusers auto-granted nomad + schizo Notes on creation (ask user) 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:
@@ -445,25 +445,44 @@ class SigReservationModelTest(TestCase):
|
||||
|
||||
|
||||
class SigCardHelperTest(TestCase):
|
||||
"""levity_sig_cards() and gravity_sig_cards() return 18 cards each.
|
||||
"""levity_sig_cards() and gravity_sig_cards() return 16 courts by default;
|
||||
Nomad/Schizo added when the user has the matching Note unlock.
|
||||
Relies on the Earthman deck seeded by migrations (no manual card creation).
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
# Earthman deck is already seeded by migrations
|
||||
from django.utils import timezone
|
||||
self.earthman = DeckVariant.objects.get(slug="earthman")
|
||||
self.owner = User.objects.create(email="founder@test.io")
|
||||
self.owner.equipped_deck = self.earthman
|
||||
self.owner.save()
|
||||
self.room = Room.objects.create(name="Card Test", owner=self.owner)
|
||||
TableSeat.objects.create(
|
||||
room=Room.objects.create(name="Card Test", owner=self.owner),
|
||||
gamer=self.owner, slot_number=1, role="PC",
|
||||
deck_variant=self.earthman,
|
||||
)
|
||||
self.room = self.owner.table_seats.first().room
|
||||
self._tz = timezone
|
||||
|
||||
def test_levity_sig_cards_returns_18(self):
|
||||
cards = levity_sig_cards(self.room)
|
||||
self.assertEqual(len(cards), 18)
|
||||
def test_levity_sig_cards_returns_16_without_notes(self):
|
||||
cards = levity_sig_cards(self.room, self.owner)
|
||||
self.assertEqual(len(cards), 16)
|
||||
|
||||
def test_gravity_sig_cards_returns_18(self):
|
||||
cards = gravity_sig_cards(self.room)
|
||||
self.assertEqual(len(cards), 18)
|
||||
def test_gravity_sig_cards_returns_16_without_notes(self):
|
||||
cards = gravity_sig_cards(self.room, self.owner)
|
||||
self.assertEqual(len(cards), 16)
|
||||
|
||||
def test_nomad_note_includes_nomad(self):
|
||||
from apps.drama.models import Note
|
||||
Note.objects.create(user=self.owner, slug="nomad", earned_at=self._tz.now())
|
||||
cards = levity_sig_cards(self.room, self.owner)
|
||||
self.assertEqual(len(cards), 17)
|
||||
self.assertTrue(any(c.number == 0 and c.arcana == "MAJOR" for c in cards))
|
||||
|
||||
def test_schizo_note_includes_schizo(self):
|
||||
from apps.drama.models import Note
|
||||
Note.objects.create(user=self.owner, slug="schizo", earned_at=self._tz.now())
|
||||
cards = levity_sig_cards(self.room, self.owner)
|
||||
self.assertEqual(len(cards), 17)
|
||||
self.assertTrue(any(c.number == 1 and c.arcana == "MAJOR" for c in cards))
|
||||
|
||||
def test_levity_and_gravity_share_same_card_objects(self):
|
||||
"""Both piles draw from the same 18 TarotCard instances — visual distinction
|
||||
@@ -475,11 +494,13 @@ class SigCardHelperTest(TestCase):
|
||||
sorted(c.pk for c in gravity),
|
||||
)
|
||||
|
||||
def test_returns_empty_when_no_equipped_deck(self):
|
||||
def test_returns_empty_when_no_deck_on_seats_or_owner(self):
|
||||
"""Falls back to empty list when neither seats nor owner have a deck."""
|
||||
self.room.table_seats.update(deck_variant=None)
|
||||
self.owner.equipped_deck = None
|
||||
self.owner.save()
|
||||
self.assertEqual(levity_sig_cards(self.room), [])
|
||||
self.assertEqual(gravity_sig_cards(self.room), [])
|
||||
self.assertEqual(levity_sig_cards(self.room, self.owner), [])
|
||||
self.assertEqual(gravity_sig_cards(self.room, self.owner), [])
|
||||
|
||||
|
||||
class TarotCardCautionsTest(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user