12 lines
741 B
Python
12 lines
741 B
Python
from roborto_accounting.reporting.documents.theme import DocumentTheme
|
|
from reportlab.platypus import Paragraph
|
|
|
|
def test_shared_theme_generates_deterministic_a4_pdf(tmp_path):
|
|
logo=__import__("pathlib").Path("assets/branding/logo-light.svg")
|
|
theme=DocumentTheme(logo);story=theme.header(["accounts@roborto.net"])+theme.heading("INVOICE")
|
|
story.append(Paragraph("Correct accounting content",theme.body))
|
|
first=theme.build(tmp_path/"first.pdf",story)
|
|
story2=theme.header(["accounts@roborto.net"])+theme.heading("INVOICE")+[Paragraph("Correct accounting content",theme.body)]
|
|
second=theme.build(tmp_path/"second.pdf",story2)
|
|
assert first.read_bytes().startswith(b"%PDF") and first.read_bytes()==second.read_bytes()
|