fix maildata handling after prematurely merging #369

This commit is contained in:
holger krekel
2024-07-13 19:05:52 +02:00
parent c1fd573de2
commit c4f46dc499
3 changed files with 4 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
From: {from_addr}
To: {to_addr}
Subject: {replaced_subject}
Subject: {subject}
Date: Sun, 15 Oct 2023 16:43:21 +0000
Message-ID: <Mr.UVyJWZmkCKM.hGzNc6glBE_@c2.testrun.org>
In-Reply-To: <Mr.MvmCz-GQbi_.6FGRkhDf05c@c2.testrun.org>

View File

@@ -71,11 +71,11 @@ def maildata(request):
assert datadir.exists(), datadir
def maildata(name, **kwargs):
def maildata(name, from_addr, to_addr, subject="..."):
# Using `.read_bytes().decode()` instead of `.read_text()` to preserve newlines.
data = datadir.joinpath(name).read_bytes().decode()
text = data.format(**kwargs)
text = data.format(from_addr=from_addr, to_addr=to_addr, subject=subject)
return BytesParser(policy=policy.default).parsebytes(text.encode())
return maildata

View File

@@ -59,7 +59,7 @@ def test_filtermail_encryption_detection(maildata):
"encrypted.eml",
from_addr="1@example.org",
to_addr="2@example.org",
replaced_subject=subject,
subject=subject,
)
assert check_encrypted(msg)