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
1=== modified file 'ubuntu_sso/tests/test_account.py'
2--- ubuntu_sso/tests/test_account.py 2011-08-22 18:20:09 +0000
3+++ ubuntu_sso/tests/test_account.py 2011-09-02 13:09:18 +0000
4@@ -18,6 +18,7 @@
5 """Tests for the SSO account code."""
6
7 import os
8+import urllib2
9
10 # Unable to import 'lazr.restfulclient.*'
11 # pylint: disable=F0401
12@@ -50,7 +51,7 @@
13 class FakedCaptchas(object):
14 """Fake the captcha generator."""
15
16- image_uri = 'file://localhost/%s' % CAPTCHA_PATH.replace(os.path.sep, '/')
17+ image_uri = CAPTCHA_PATH
18
19 def new(self):
20 """Return a local fake captcha."""
21@@ -149,6 +150,14 @@
22
23 def setUp(self):
24 """Init."""
25+
26+ def fake_urlopen(url):
27+ """Fake an urlopen which will read from the disk."""
28+ f = open(url)
29+ self.addCleanup(f.close)
30+ return f
31+
32+ self.patch(urllib2, 'urlopen', fake_urlopen) # fd to the path
33 self.processor = Account(sso_service_class=FakedSSOServer)
34 self.register_kwargs = dict(email=EMAIL, password=PASSWORD,
35 displayname=NAME,

Subscribers

People subscribed via source and target branches