mirror of
https://github.com/chatmail/relay.git
synced 2026-05-17 04:28:57 +00:00
passes the test
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from chatmaild.filtermail import check_encrypted, check_DATA, SendRateLimiter
|
||||
from chatmaild.filtermail import check_encrypted, check_DATA, SendRateLimiter, check_mdn
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -41,8 +41,33 @@ def test_filtermail_encryption_detection(maildata):
|
||||
assert not check_encrypted(msg)
|
||||
|
||||
|
||||
def test_filtermail_mdn_is_not_encrypted(maildata):
|
||||
assert not check_encrypted(maildata("mdn.eml"))
|
||||
def test_filtermail_is_mdn(maildata, gencreds):
|
||||
from_addr = gencreds()[0]
|
||||
to_addr = gencreds()[0] + ".other"
|
||||
msg = maildata("mdn.eml", from_addr, to_addr)
|
||||
|
||||
class env:
|
||||
mail_from = from_addr
|
||||
rcpt_tos = [to_addr]
|
||||
content = msg.as_bytes()
|
||||
|
||||
assert check_mdn(msg, env)
|
||||
print(msg.as_string())
|
||||
assert not check_DATA(env)
|
||||
|
||||
|
||||
def test_filtermail_to_multiple_recipients_no_mdn(maildata, gencreds):
|
||||
from_addr = gencreds()[0]
|
||||
to_addr = gencreds()[0] + ".other"
|
||||
thirdaddr = gencreds()[0]
|
||||
msg = maildata("mdn.eml", from_addr, to_addr)
|
||||
|
||||
class env:
|
||||
mail_from = from_addr
|
||||
rcpt_tos = [to_addr, thirdaddr]
|
||||
content = msg.as_bytes()
|
||||
|
||||
assert not check_mdn(msg, env)
|
||||
|
||||
|
||||
def test_send_rate_limiter():
|
||||
|
||||
@@ -290,7 +290,7 @@ class Remote:
|
||||
def maildata(request, gencreds):
|
||||
datadir = conftestdir.joinpath("mail-data")
|
||||
|
||||
def maildata(name, parsed=True, from_addr=None, to_addr=None):
|
||||
def maildata(name, from_addr=None, to_addr=None):
|
||||
if from_addr is None:
|
||||
from_addr = gencreds()[0]
|
||||
if to_addr is None:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Subject: Message opened
|
||||
From: <barbaz@c2.testrun.org>
|
||||
To: <foobar@c2.testrun.org>
|
||||
From: <{from_addr}>
|
||||
To: <{to_addr}>
|
||||
Date: Sun, 15 Oct 2023 16:43:25 +0000
|
||||
Message-ID: <Mr.78MWtlV7RAi.goCFzBhCYfy@c2.testrun.org>
|
||||
Auto-Submitted: auto-replied
|
||||
|
||||
Reference in New Issue
Block a user