Add tests for alternate mail subjects

This commit is contained in:
Daniel Kahn Gillmor
2024-07-13 18:33:42 +02:00
committed by holger krekel
parent c6b083472f
commit c1fd573de2
3 changed files with 15 additions and 9 deletions
+2 -2
View File
@@ -71,11 +71,11 @@ def maildata(request):
assert datadir.exists(), datadir
def maildata(name, from_addr, to_addr):
def maildata(name, **kwargs):
# Using `.read_bytes().decode()` instead of `.read_text()` to preserve newlines.
data = datadir.joinpath(name).read_bytes().decode()
text = data.format(from_addr=from_addr, to_addr=to_addr)
text = data.format(**kwargs)
return BytesParser(policy=policy.default).parsebytes(text.encode())
return maildata