Merge ~cjwatson/launchpad:py3-email-decode-bytes-2 into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: ec95ca3b2ee9ee454b8809ce12a4e7b732238878
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-email-decode-bytes-2
Merge into: launchpad:master
Diff against target: 84 lines (+9/-9)
1 file modified
lib/lp/bugs/tests/bugs-emailinterface.txt (+9/-9)
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+398379@code.launchpad.net

Commit message

Fix types in email payload tests (take 2)

Description of the change

Similar to b893599efb655cc455da9909948fd2937513ac27 (https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397707), but I missed a few spots.

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
diff --git a/lib/lp/bugs/tests/bugs-emailinterface.txt b/lib/lp/bugs/tests/bugs-emailinterface.txt
index 3a3c01a..271e77d 100644
--- a/lib/lp/bugs/tests/bugs-emailinterface.txt
+++ b/lib/lp/bugs/tests/bugs-emailinterface.txt
@@ -361,7 +361,7 @@ And the person sending the email has received an error message.
361 ... print("Subject: %s" % sent_msg['Subject'])361 ... print("Subject: %s" % sent_msg['Subject'])
362 ... print("To: %s" % ', '.join(to_addrs))362 ... print("To: %s" % ', '.join(to_addrs))
363 ... print()363 ... print()
364 ... print(error_mail.get_payload(decode=True))364 ... print(error_mail.get_payload(decode=True).decode('UTF-8'))
365365
366 >>> print_latest_email()366 >>> print_latest_email()
367 Subject: Submit Request Failure367 Subject: Submit Request Failure
@@ -2070,7 +2070,7 @@ The sent message contains two parts:
20702070
2071The first part is the error message, explaining what went wrong.2071The first part is the error message, explaining what went wrong.
20722072
2073 >>> print(failure_msg.get_payload(decode=True))2073 >>> print(failure_msg.get_payload(decode=True).decode('UTF-8'))
2074 An error occurred while processing a mail you sent to Launchpad's email2074 An error occurred while processing a mail you sent to Launchpad's email
2075 interface.2075 interface.
2076 <BLANKLINE>2076 <BLANKLINE>
@@ -2099,7 +2099,7 @@ error to happen.
2099 'Original Message Subject'2099 'Original Message Subject'
2100 >>> msg['Message-Id']2100 >>> msg['Message-Id']
2101 '<original@msg>'2101 '<original@msg>'
2102 >>> print(msg.get_payload(decode=True))2102 >>> print(msg.get_payload(decode=True).decode('UTF-8'))
2103 Original message body.2103 Original message body.
21042104
2105Sometimes the original error was caused by the original message being2105Sometimes the original error was caused by the original message being
@@ -2213,7 +2213,7 @@ failure in an email.
2213 >>> from_addr, to_addrs, raw_message = stub.test_emails[-1]2213 >>> from_addr, to_addrs, raw_message = stub.test_emails[-1]
2214 >>> sent_msg = email.message_from_string(raw_message)2214 >>> sent_msg = email.message_from_string(raw_message)
2215 >>> failure_msg, original_msg = sent_msg.get_payload()2215 >>> failure_msg, original_msg = sent_msg.get_payload()
2216 >>> print(failure_msg.get_payload(decode=True))2216 >>> print(failure_msg.get_payload(decode=True).decode('UTF-8'))
2217 An error occurred while processing a mail you sent to Launchpad's email2217 An error occurred while processing a mail you sent to Launchpad's email
2218 interface.2218 interface.
2219 <BLANKLINE>2219 <BLANKLINE>
@@ -2261,7 +2261,7 @@ And the sender receives an email to let them know about the failing
2261 >>> from_addr, to_addrs, raw_message = stub.test_emails[-1]2261 >>> from_addr, to_addrs, raw_message = stub.test_emails[-1]
2262 >>> sent_msg = email.message_from_string(raw_message)2262 >>> sent_msg = email.message_from_string(raw_message)
2263 >>> failure_msg, original_msg = sent_msg.get_payload()2263 >>> failure_msg, original_msg = sent_msg.get_payload()
2264 >>> print(failure_msg.get_payload(decode=True))2264 >>> print(failure_msg.get_payload(decode=True).decode('UTF-8'))
2265 An error occurred while processing a mail you sent to Launchpad's email2265 An error occurred while processing a mail you sent to Launchpad's email
2266 interface.2266 interface.
2267 <BLANKLINE>2267 <BLANKLINE>
@@ -2335,7 +2335,7 @@ email too. Just send an email to `help@bugs.launchpad.net`.
2335 ... """2335 ... """
2336 >>> process_email(submit_mail)2336 >>> process_email(submit_mail)
2337 >>> from_addr, to_addrs, raw_message = stub.test_emails[-1]2337 >>> from_addr, to_addrs, raw_message = stub.test_emails[-1]
2338 >>> print(raw_message)2338 >>> print(raw_message.decode('UTF-8'))
2339 Content-Type: text/plain; charset="utf-8"2339 Content-Type: text/plain; charset="utf-8"
2340 ...2340 ...
2341 To: test@canonical.com2341 To: test@canonical.com
@@ -2355,7 +2355,7 @@ Only mail coming from verified Launchpad users is answered.
2355 ... help2355 ... help
2356 ... """2356 ... """
2357 >>> process_email(submit_mail)2357 >>> process_email(submit_mail)
2358 >>> 'nobody@nowhere.com' in stub.test_emails[-1][2]2358 >>> b'nobody@nowhere.com' in stub.test_emails[-1][2]
2359 False2359 False
23602360
2361The help text is taken from the Launchpad help wiki as raw text, and2361The help text is taken from the Launchpad help wiki as raw text, and
@@ -3014,7 +3014,7 @@ importing machinery.
3014 >>> comment_date = datetime(3014 >>> comment_date = datetime(
3015 ... 2008, 5, 19, 16, 19, 12, tzinfo=pytz.timezone('Europe/Prague'))3015 ... 2008, 5, 19, 16, 19, 12, tzinfo=pytz.timezone('Europe/Prague'))
30163016
3017 >>> initial_mail = b"""From: test@canonical.com3017 >>> initial_mail = ("""From: test@canonical.com
3018 ... To: %(bug_id)s@malone-domain3018 ... To: %(bug_id)s@malone-domain
3019 ... Date: %(date)s3019 ... Date: %(date)s
3020 ... Message-Id: <76543@launchpad.net>3020 ... Message-Id: <76543@launchpad.net>
@@ -3026,7 +3026,7 @@ importing machinery.
3026 ... """ % {3026 ... """ % {
3027 ... 'bug_id': bug_with_watch.id,3027 ... 'bug_id': bug_with_watch.id,
3028 ... 'date': comment_date.strftime('%a %b %d %H:%M:%S %Z %Y'),3028 ... 'date': comment_date.strftime('%a %b %d %H:%M:%S %Z %Y'),
3029 ... }3029 ... }).encode('ASCII')
3030 >>> message = getUtility(IMessageSet).fromEmail(3030 >>> message = getUtility(IMessageSet).fromEmail(
3031 ... initial_mail, no_priv)3031 ... initial_mail, no_priv)
30323032

Subscribers

People subscribed via source and target branches

to status/vote changes: