Merge lp:~dobey/ubuntu-sso-client/twisted-14-fixes into lp:ubuntu-sso-client

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 1036
Merged at revision: 1036
Proposed branch: lp:~dobey/ubuntu-sso-client/twisted-14-fixes
Merge into: lp:ubuntu-sso-client
Diff against target: 45 lines (+6/-2)
2 files modified
ubuntu_sso/main/tests/test_common.py (+2/-0)
ubuntu_sso/utils/webclient/tests/test_webclient.py (+4/-2)
To merge this branch: bzr merge lp:~dobey/ubuntu-sso-client/twisted-14-fixes
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+230735@code.launchpad.net

Commit message

Fix tests to work properly and under twisted 14.

Description of the change

With twisted 14.0.0, trial will error out on tests that are calling yield, but are not wrapped with defer. Some tests were broken in this regard, and passing when they shouldn't have been. This fixes those tests.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/main/tests/test_common.py'
2--- ubuntu_sso/main/tests/test_common.py 2013-01-24 22:51:29 +0000
3+++ ubuntu_sso/main/tests/test_common.py 2014-08-14 00:49:25 +0000
4@@ -706,11 +706,13 @@
5 yield self.assert_refcounter_increased('store_credentials',
6 'CredentialsStored')
7
8+ @defer.inlineCallbacks
9 def test_register(self):
10 """Keep proper track of ongoing requests."""
11 yield self.assert_refcounter_increased('register',
12 'CredentialsFound')
13
14+ @defer.inlineCallbacks
15 def test_login(self):
16 """Keep proper track of ongoing requests."""
17 yield self.assert_refcounter_increased('login',
18
19=== modified file 'ubuntu_sso/utils/webclient/tests/test_webclient.py'
20--- ubuntu_sso/utils/webclient/tests/test_webclient.py 2013-04-12 20:09:12 +0000
21+++ ubuntu_sso/utils/webclient/tests/test_webclient.py 2014-08-14 00:49:25 +0000
22@@ -910,19 +910,21 @@
23 self.retry)
24 self.assertFalse(got_creds, 'Return false when creds are not present.')
25
26+ @defer.inlineCallbacks
27 def test_user_cancelation(self):
28 """Test the case in which the user cancels."""
29 self.spawn_return_code = USER_CANCELLATION
30 got_creds = yield self.wc.request_proxy_auth_credentials(self.domain,
31 self.retry)
32- self.assertFalse(got_creds, 'Return true when user cancels.')
33+ self.assertTrue(got_creds, 'Return true when user cancels.')
34
35+ @defer.inlineCallbacks
36 def test_exception_error(self):
37 """Test the case in which something bad happened."""
38 self.spawn_return_code = EXCEPTION_RAISED
39 got_creds = yield self.wc.request_proxy_auth_credentials(self.domain,
40 self.retry)
41- self.assertFalse(got_creds, 'Return true when user cancels.')
42+ self.assertTrue(got_creds, 'Return true when user cancels.')
43
44
45 class BaseSSLTestCase(SquidTestCase):

Subscribers

People subscribed via source and target branches