refactor: tidy up DecodeCharset

This commit is contained in:
James Houlahan
2020-05-08 09:54:11 +02:00
parent 37f4e46bdc
commit f87ca36ffd
4 changed files with 64 additions and 47 deletions

View File

@ -3,21 +3,6 @@ Feature: SMTP wrong messages
Given there is connected user "user"
And there is SMTP client logged in as "user"
Scenario: Message with no charset and bad character
When SMTP client sends message
"""
From: Bridge Test <bridgetest@pm.test>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Plain text, no charset, wrong base64 external
Content-Disposition: inline
Content-Type: text/plain;
Content-Transfer-Encoding: base64
sdfsdfsd
"""
Then SMTP response is "SMTP error: 554 Error: transaction failed, blame it on the weather: non-utf8 content without charset specification"
Scenario: Message with attachment and wrong boundaries
When SMTP client sends message
"""
@ -53,4 +38,4 @@ Feature: SMTP wrong messages
"""
Then SMTP response is "SMTP error: 554 Error: transaction failed, blame it on the weather: multipart: NextPart: EOF"
Then SMTP response is "SMTP error: 554 Error: transaction failed, blame it on the weather: multipart: NextPart: EOF"

View File

@ -145,7 +145,7 @@ Feature: SMTP sending of plain messages
}
"""
Scenario: Message without charset
Scenario: Message without charset is utf8
When SMTP client sends message
"""
From: Bridge Test <bridgetest@pm.test>
@ -156,6 +156,46 @@ Feature: SMTP sending of plain messages
This is body of mail without charset. Please assume utf8
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages
| time | from | to | subject |
| now | [userAddress] | pm.bridge.qa@gmail.com | Plain text no charset external |
And message is sent with API call:
"""
{
"Message": {
"Subject": "Plain text no charset external",
"Sender": {
"Name": "Bridge Test"
},
"ToList": [
{
"Address": "pm.bridge.qa@gmail.com",
"Name": "External Bridge"
}
],
"CCList": [],
"BCCList": [],
"MIMEType": "text/plain"
}
}
"""
Scenario: Message without charset is base64-encoded latin1
When SMTP client sends message
"""
From: Bridge Test <bridgetest@pm.test>
To: External Bridge <pm.bridge.qa@gmail.com>
Subject: Plain text no charset external
Content-Disposition: inline
Content-Type: text/plain;
Content-Transfer-Encoding: base64
dGhpcyBpcyBpbiBsYXRpbjEgYW5kIHRoZXJlIGFyZSBsb3RzIG9mIGVzIHdpdGggYWNjZW50czog
6enp6enp6enp6enp6enp
"""
Then SMTP response is "OK"
And mailbox "Sent" for "user" has messages