mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
GODT-1777: Message de-duplication in SMTP
This commit is contained in:
58
tests/features/smtp/send/same_message.feature
Normal file
58
tests/features/smtp/send/same_message.feature
Normal file
@ -0,0 +1,58 @@
|
||||
Feature: SMTP sending the same message twice
|
||||
Background:
|
||||
Given there exists an account with username "user@pm.me" and password "password"
|
||||
And there exists an account with username "bridgetest@protonmail.com" and password "password"
|
||||
And bridge starts
|
||||
And the user logs in with username "user@pm.me" and password "password"
|
||||
And the user logs in with username "bridgetest@protonmail.com" and password "password"
|
||||
And user "user@pm.me" connects and authenticates SMTP client "1"
|
||||
And SMTP client "1" sends the following message from "user@pm.me" to "bridgetest@protonmail.com":
|
||||
"""
|
||||
From: Bridge Test <user@pm.me>
|
||||
To: Internal Bridge <bridgetest@protonmail.com>
|
||||
Subject: Hello
|
||||
|
||||
World
|
||||
"""
|
||||
And it succeeds
|
||||
|
||||
Scenario: The exact same message is not sent twice
|
||||
When SMTP client "1" sends the following message from "user@pm.me" to "bridgetest@protonmail.com":
|
||||
"""
|
||||
From: Bridge Test <user@pm.me>
|
||||
To: Internal Bridge <bridgetest@protonmail.com>
|
||||
Subject: Hello
|
||||
|
||||
World
|
||||
"""
|
||||
Then it succeeds
|
||||
When user "user@pm.me" connects and authenticates IMAP client "1"
|
||||
Then IMAP client "1" eventually sees the following messages in "Sent":
|
||||
| from | to | subject | body |
|
||||
| user@pm.me | bridgetest@protonmail.com | Hello | World |
|
||||
When user "bridgetest@protonmail.com" connects and authenticates IMAP client "2"
|
||||
Then IMAP client "2" eventually sees the following messages in "Inbox":
|
||||
| from | to | subject | body |
|
||||
| user@pm.me | bridgetest@protonmail.com | Hello | World |
|
||||
|
||||
|
||||
Scenario: Slight change means different message and is sent twice
|
||||
When SMTP client "1" sends the following message from "user@pm.me" to "bridgetest@protonmail.com":
|
||||
"""
|
||||
From: Bridge Test <user@pm.me>
|
||||
To: Internal Bridge <bridgetest@protonmail.com>
|
||||
Subject: Hello.
|
||||
|
||||
World
|
||||
"""
|
||||
Then it succeeds
|
||||
When user "user@pm.me" connects and authenticates IMAP client "1"
|
||||
Then IMAP client "1" eventually sees the following messages in "Sent":
|
||||
| from | to | subject | body |
|
||||
| user@pm.me | bridgetest@protonmail.com | Hello | World |
|
||||
| user@pm.me | bridgetest@protonmail.com | Hello. | World |
|
||||
When user "bridgetest@protonmail.com" connects and authenticates IMAP client "2"
|
||||
Then IMAP client "2" eventually sees the following messages in "Inbox":
|
||||
| from | to | subject | body |
|
||||
| user@pm.me | bridgetest@protonmail.com | Hello | World |
|
||||
| user@pm.me | bridgetest@protonmail.com | Hello. | World |
|
||||
48
tests/features/smtp/send/send_append.feature
Normal file
48
tests/features/smtp/send/send_append.feature
Normal file
@ -0,0 +1,48 @@
|
||||
Feature: SMTP sending with APPENDing to Sent
|
||||
Background:
|
||||
Given there exists an account with username "user@pm.me" and password "password"
|
||||
And there exists an account with username "bridgetest@protonmail.com" and password "password"
|
||||
And bridge starts
|
||||
And the user logs in with username "user@pm.me" and password "password"
|
||||
And user "user@pm.me" connects and authenticates SMTP client "1"
|
||||
And user "user@pm.me" connects and authenticates IMAP client "1"
|
||||
|
||||
Scenario: Send message and append to Sent
|
||||
# First do sending.
|
||||
When SMTP client "1" sends the following message from "user@pm.me" to "bridgetest@protonmail.com":
|
||||
"""
|
||||
To: Internal Bridge <bridgetest@protonmail.com>
|
||||
Subject: Manual send and append
|
||||
Message-ID: bridgemessage42
|
||||
|
||||
hello
|
||||
|
||||
"""
|
||||
Then it succeeds
|
||||
And the body in the "POST" request to "/mail/v4/messages" is:
|
||||
"""
|
||||
{
|
||||
"Message": {
|
||||
"Subject": "Manual send and append",
|
||||
"ExternalID": "bridgemessage42"
|
||||
}
|
||||
}
|
||||
"""
|
||||
And IMAP client "1" eventually sees the following messages in "Sent":
|
||||
| to | subject | body | message-id |
|
||||
| bridgetest@protonmail.com | Manual send and append | hello | <bridgemessage42> |
|
||||
|
||||
# Then simulate manual append to Sent mailbox - message should be detected as a duplicate.
|
||||
When IMAP client "1" appends the following message to "Sent":
|
||||
"""
|
||||
To: Internal Bridge <bridgetest@protonmail.com>
|
||||
Subject: Manual send and append
|
||||
Message-ID: bridgemessage42
|
||||
|
||||
hello
|
||||
|
||||
"""
|
||||
Then it succeeds
|
||||
And IMAP client "1" eventually sees the following messages in "Sent":
|
||||
| to | subject | body | message-id |
|
||||
| bridgetest@protonmail.com | Manual send and append | hello | <bridgemessage42> |
|
||||
Reference in New Issue
Block a user