Merge lp:~nataliabidart/ubuntu-sso-client/build-lucid into lp:ubuntu-sso-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Roberto Alsina
Approved revision: 773
Merged at revision: 774
Proposed branch: lp:~nataliabidart/ubuntu-sso-client/build-lucid
Merge into: lp:ubuntu-sso-client
Diff against target: 35 lines (+10/-1)
1 file modified
ubuntu_sso/tests/test_account.py (+10/-1)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-sso-client/build-lucid
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+73805@code.launchpad.net

Commit message

- Stop using file: uris and patch urlopen to avoid crashes (LP: #839544).

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1 trivial

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu_sso/tests/test_account.py'
--- ubuntu_sso/tests/test_account.py 2011-08-22 18:20:09 +0000
+++ ubuntu_sso/tests/test_account.py 2011-09-02 13:09:18 +0000
@@ -18,6 +18,7 @@
18"""Tests for the SSO account code."""18"""Tests for the SSO account code."""
1919
20import os20import os
21import urllib2
2122
22# Unable to import 'lazr.restfulclient.*'23# Unable to import 'lazr.restfulclient.*'
23# pylint: disable=F040124# pylint: disable=F0401
@@ -50,7 +51,7 @@
50class FakedCaptchas(object):51class FakedCaptchas(object):
51 """Fake the captcha generator."""52 """Fake the captcha generator."""
5253
53 image_uri = 'file://localhost/%s' % CAPTCHA_PATH.replace(os.path.sep, '/')54 image_uri = CAPTCHA_PATH
5455
55 def new(self):56 def new(self):
56 """Return a local fake captcha."""57 """Return a local fake captcha."""
@@ -149,6 +150,14 @@
149150
150 def setUp(self):151 def setUp(self):
151 """Init."""152 """Init."""
153
154 def fake_urlopen(url):
155 """Fake an urlopen which will read from the disk."""
156 f = open(url)
157 self.addCleanup(f.close)
158 return f
159
160 self.patch(urllib2, 'urlopen', fake_urlopen) # fd to the path
152 self.processor = Account(sso_service_class=FakedSSOServer)161 self.processor = Account(sso_service_class=FakedSSOServer)
153 self.register_kwargs = dict(email=EMAIL, password=PASSWORD,162 self.register_kwargs = dict(email=EMAIL, password=PASSWORD,
154 displayname=NAME,163 displayname=NAME,

Subscribers

People subscribed via source and target branches