Merge lp:~elopio/u1-test-utils/fix1197028-localmail_SMTPClient into lp:u1-test-utils

Proposed by Leo Arias
Status: Merged
Approved by: Leo Arias
Approved revision: 87
Merged at revision: 83
Proposed branch: lp:~elopio/u1-test-utils/fix1197028-localmail_SMTPClient
Merge into: lp:u1-test-utils
Diff against target: 73 lines (+17/-12)
3 files modified
fabfile/development.py (+4/-0)
requirements.txt (+1/-1)
u1testutils/selftests/unit/test_mail.py (+12/-11)
To merge this branch: bzr merge lp:~elopio/u1-test-utils/fix1197028-localmail_SMTPClient
Reviewer Review Type Date Requested Status
Corey Goldberg (community) Approve
Review via email: mp+172628@code.launchpad.net

Commit message

Updated localmail to version 36, and pinned it.

To post a comment you must log in.
Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

lgtm.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'fabfile/development.py'
2--- fabfile/development.py 2013-04-09 19:06:01 +0000
3+++ fabfile/development.py 2013-07-02 16:56:07 +0000
4@@ -15,6 +15,8 @@
5 import os
6 import unittest
7
8+from fabric import api
9+
10
11 def test(suites=None):
12 """Run tests.
13@@ -46,6 +48,8 @@
14 res = runner.run(suite)
15 print 'Totals: ran({0}), skipped({1}), errors({2}), failures({3})'.format(
16 res.testsRun, len(res.skipped), len(res.errors), len(res.failures))
17+ if not res.wasSuccessful():
18+ api.abort('Tests failed.')
19
20
21 def _load_static_tests(suite):
22
23=== modified file 'requirements.txt'
24--- requirements.txt 2013-05-02 20:55:10 +0000
25+++ requirements.txt 2013-07-02 16:56:07 +0000
26@@ -5,7 +5,7 @@
27 pep8
28 pyflakes
29 Twisted
30-bzr+ssh://bazaar.launchpad.net/~bloodearnest/localmail/trunk
31+bzr+ssh://bazaar.launchpad.net/~bloodearnest/localmail/trunk@36
32 bzr+http://bazaar.launchpad.net/~ubuntuone-hackers/payclient/trunk@4
33 bzr+http://bazaar.launchpad.net/~canonical-isd-qa/selenium-simple-test/trunk@377
34 bzr+http://bazaar.launchpad.net/~canonical-isd-hackers/canonical-identity-provider/ssoclient@3
35
36=== modified file 'u1testutils/selftests/unit/test_mail.py'
37--- u1testutils/selftests/unit/test_mail.py 2013-05-22 13:13:01 +0000
38+++ u1testutils/selftests/unit/test_mail.py 2013-07-02 16:56:07 +0000
39@@ -18,6 +18,7 @@
40 import threading
41 import time
42 import unittest
43+from email.mime import text as mime_text
44
45 import localmail
46 import localmail.tests.helpers
47@@ -56,15 +57,15 @@
48 localmail.shutdown_thread(class_.localmail_thread)
49
50 def test_get_latest_email(self):
51- from_ = 'from@example.com'
52- to = 'to@example.com'
53- subject = 'Test Subject'
54- body = 'Test body'
55- with localmail.tests.helpers.SMTPHelper(port=self.SMTP_PORT) as smtp:
56- smtp.login()
57- smtp.send(from_, to, subject, body)
58+ message = mime_text.MIMEText('Test body')
59+ message['Subject'] = 'Test Subject'
60+ message['From'] = 'from@example.com'
61+ message['To'] = 'to@example.com'
62+ with localmail.tests.helpers.SMTPClient(port=self.SMTP_PORT) as smtp:
63+ smtp.send(message)
64 latest_email = mail.get_latest_email_sent_to('to@example.com')
65- self.assertEquals(latest_email['From'], from_)
66- self.assertEquals(latest_email['To'], to)
67- self.assertEquals(latest_email['Subject'], subject)
68- self.assertEquals(latest_email.get_payload(), body + '\n')
69+ self.assertEquals(latest_email['From'], message['From'])
70+ self.assertEquals(latest_email['To'], message['To'])
71+ self.assertEquals(latest_email['Subject'], message['Subject'])
72+ self.assertEquals(
73+ latest_email.get_payload(), message.get_payload() + '\n')

Subscribers

People subscribed via source and target branches

to all changes: