Merge ~cjwatson/launchpad:py3-parseaddr-round-trip into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: f72294643a23deab06144dc8e12f5f73708c09ed
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-parseaddr-round-trip
Merge into: launchpad:master
Diff against target: 15 lines (+2/-2)
1 file modified
lib/lp/services/mail/doc/sending-mail.txt (+2/-2)
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+398700@code.launchpad.net

Commit message

Test parseaddr round-tripping in sending-mail.txt

Description of the change

On Python 3, `simple_sendmail_from_person` (via `email.utils.formataddr`) formats some names slightly differently. For instance, 'Foo [Baz] " Bar' is encoded as "Foo [Baz] \" Bar" rather than "Foo \[Baz\] \" Bar". What we really care about is that the result parses correctly, so test that rather than the exact details of the encoding.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/mail/doc/sending-mail.txt b/lib/lp/services/mail/doc/sending-mail.txt
2index ecf5c50..ad7e235 100644
3--- a/lib/lp/services/mail/doc/sending-mail.txt
4+++ b/lib/lp/services/mail/doc/sending-mail.txt
5@@ -184,8 +184,8 @@ surrounded by quotes and quoted if necessary:
6
7 >>> from_addr, to_addr, raw_message = stub.test_emails.pop()
8 >>> msg = message_from_bytes(raw_message)
9- >>> print(msg['From'])
10- "Foo \[Baz\] \" Bar" <foo.bar@canonical.com>
11+ >>> parseaddr(msg['From'])
12+ ('Foo [Baz] " Bar', 'foo.bar@canonical.com')
13
14
15 If we pass a unicode object to send_mail, it will try and covert it. If a

Subscribers

People subscribed via source and target branches

to status/vote changes: