"""FT — @taxman "Debits & credits" Post detail (user-spec 2026-05-26). After a FREE/PAID DRAW spend at /gameboard/my-sea/, the @taxman ledger Post is reachable at /billboard/post//. The detail page renders the ledger Line(s) with the @taxman handle, the readonly "No response needed at this time" input (parallel to the @adman Note-unlock Post), and the display strips the `[] ` prefix that the underlying Line text carries to satisfy `unique_together = (post, text)`. Mirrors `test_bill_post_gear.py`'s setup shape — seed via the ORM (the `log_tax_debit` helper) instead of walking the my_sea picker UI, so the FT focuses on the post-detail surface, not the spend trigger.""" from selenium.webdriver.common.by import By from apps.billboard.models import Post from apps.billboard.tax import log_tax_debit from apps.lyric.models import User from .base import FunctionalTest class DebitsAndCreditsPostTest(FunctionalTest): def setUp(self): super().setUp() self.user = User.objects.create(email="taxpayer@test.io") # Seed two debits — covers both slug templates. log_tax_debit(self.user, "free_draw_locked") log_tax_debit(self.user, "paid_draw_locked") self.post = Post.objects.get( owner=self.user, kind=Post.KIND_TAX_LEDGER, ) self.create_pre_authenticated_session("taxpayer@test.io") def test_debits_credits_post_renders_readonly_input_with_no_response_placeholder(self): self.browser.get( self.live_server_url + f"/billboard/post/{self.post.id}/" ) # Page text already decodes "Debits & credits" → "Debits & credits". self.wait_for( lambda: self.assertIn( "Debits & credits", self.browser.find_element(By.TAG_NAME, "body").text, ) ) # The response input is readonly w. the system-author placeholder. field = self.browser.find_element(By.ID, "id_post_line_text") self.assertEqual( field.get_attribute("placeholder"), "No response needed at this time", ) self.assertTrue(field.get_attribute("readonly")) # Both seeded debit Lines render w. the canonical body text, NOT # the raw `[] ` prefix (Line.display_text strips it). page_text = self.browser.find_element(By.TAG_NAME, "body").text self.assertIn("FREE DRAW is locked", page_text) self.assertIn("PAID DRAW is locked", page_text) self.assertNotIn("[20", page_text, "The `[] ` prefix on Line.text must NOT display " "— Line.display_text strips it for TAX_LEDGER posts") # @taxman attribution renders on each line. self.assertIn("@taxman", page_text)