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")

    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")


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,")

    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")
