Skip to content

Commit

Permalink
add test for secure-join: vc-request
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Jan 24, 2025
1 parent 34e2bfc commit 55fea78
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
21 changes: 21 additions & 0 deletions chatmaild/src/chatmaild/tests/mail-data/securejoin-vc-fake.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Subject: Message from {from_addr}
From: <{from_addr}>
To: <{to_addr}>
Date: Sun, 15 Oct 2023 16:43:25 +0000
Message-ID: <[email protected]>
Chat-Version: 1.0
Secure-Join: vc-request
Secure-Join-Invitenumber: RANDOM-TOKEN
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi"


--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi
Content-Type: text/plain; charset=utf-8
Buy viagra!
--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi--


21 changes: 21 additions & 0 deletions chatmaild/src/chatmaild/tests/mail-data/securejoin-vc.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Subject: Message from {from_addr}
From: <{from_addr}>
To: <{to_addr}>
Date: Sun, 15 Oct 2023 16:43:25 +0000
Message-ID: <[email protected]>
Chat-Version: 1.0
Secure-Join: vc-request
Secure-Join-Invitenumber: RANDOM-TOKEN
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi"


--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi
Content-Type: text/plain; charset=utf-8
Secure-Join: vc-request
--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi--


14 changes: 14 additions & 0 deletions chatmaild/src/chatmaild/tests/test_filtermail.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ def test_filtermail_no_encryption_detection(maildata):
assert not check_encrypted(msg)


def test_filtermail_securejoin_detection(maildata):
msg = maildata(
"securejoin-vc.eml", from_addr="[email protected]", to_addr="[email protected]"
)
assert is_securejoin(msg)

msg = maildata(
"securejoin-vc-fake.eml",
from_addr="[email protected]",
to_addr="[email protected]",
)
assert not is_securejoin(msg)


def test_filtermail_encryption_detection(maildata):
for subject in common_encrypted_subjects:
msg = maildata(
Expand Down

0 comments on commit 55fea78

Please sign in to comment.