def create_user_with_finished_letter(html: str = "<p>I am a letter</p>"): user = UserFactory() lr = LetterRequest(user=user, mail_choice=LOC_MAILING_CHOICES.WE_WILL_MAIL, html_content=html) lr.save() return user
def test_letter_html_prefers_prerendered_content(client): zzzz = '<p>ZZZZ</p>' user = UserFactory() lr = LetterRequest(user=user, mail_choice=LOC_MAILING_CHOICES.WE_WILL_MAIL, html_content=zzzz) lr.save() client.force_login(user) assert zzzz in get_letter_html(client) assert zzzz not in get_letter_html(client, '?live_preview=on')
def test_loc_actions_shows_pdf_link_when_user_has_letter_request(): user = UserFactory() lr = LetterRequest(user=user) lr.save() assert f'/loc/admin/{user.pk}/letter.pdf' in LetterRequestInline.loc_actions( None, lr)