Merge lp:~dobey/ubuntu-sso-client/update-4-0 into lp:ubuntu-sso-client/stable-4-0

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: no longer in the source branch.
Merged at revision: 967
Proposed branch: lp:~dobey/ubuntu-sso-client/update-4-0
Merge into: lp:ubuntu-sso-client/stable-4-0
Diff against target: 57 lines (+32/-0)
2 files modified
ubuntu_sso/utils/webclient/qtnetwork.py (+2/-0)
ubuntu_sso/utils/webclient/tests/test_qtnetwork.py (+30/-0)
To merge this branch: bzr merge lp:~dobey/ubuntu-sso-client/update-4-0
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
Review via email: mp+121669@code.launchpad.net

Commit message

[Alejandro J. Cura]

    - Use unicode strings when writing to io.StringIO (LP: #1036270).

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) :
review: Approve
967. By Alejandro J. Cura

[Alejandro J. Cura]

    - Use unicode strings when writing to io.StringIO (LP: #1036270).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu_sso/utils/webclient/qtnetwork.py'
--- ubuntu_sso/utils/webclient/qtnetwork.py 2012-07-02 19:16:16 +0000
+++ ubuntu_sso/utils/webclient/qtnetwork.py 2012-08-28 17:30:29 +0000
@@ -28,6 +28,8 @@
28# files in the program, then also delete it here.28# files in the program, then also delete it here.
29"""A webclient backend that uses QtNetwork."""29"""A webclient backend that uses QtNetwork."""
3030
31from __future__ import unicode_literals
32
31import sys33import sys
32from io import StringIO34from io import StringIO
3335
3436
=== modified file 'ubuntu_sso/utils/webclient/tests/test_qtnetwork.py'
--- ubuntu_sso/utils/webclient/tests/test_qtnetwork.py 2012-04-09 17:38:24 +0000
+++ ubuntu_sso/utils/webclient/tests/test_qtnetwork.py 2012-08-28 17:30:29 +0000
@@ -28,6 +28,7 @@
28# files in the program, then also delete it here.28# files in the program, then also delete it here.
29"""Specific tests for the qt implementation."""29"""Specific tests for the qt implementation."""
3030
31from PyQt4.QtNetwork import QSslError
31from twisted.internet import defer32from twisted.internet import defer
32from ubuntuone.devtools.testcases import TestCase33from ubuntuone.devtools.testcases import TestCase
3334
@@ -168,3 +169,32 @@
168 self.assertNotEqual(self.proxy, qtnetwork.WebClient.proxy_instance)169 self.assertNotEqual(self.proxy, qtnetwork.WebClient.proxy_instance)
169 self.assertNotIn(('systemProxyForQuery', self.query), self.called)170 self.assertNotIn(('systemProxyForQuery', self.query), self.called)
170 self.assertNotIn(('setApplicationProxy', self.proxy), self.called)171 self.assertNotIn(('setApplicationProxy', self.proxy), self.called)
172
173
174class FakeQNetworkReply(object):
175 """A fake QNetworkReply."""
176
177 def __init__(self):
178 """Initialize this fake."""
179 url = qtnetwork.QUrl("http://fake_server")
180 self._request = qtnetwork.QNetworkRequest(url)
181
182 def request(self):
183 """Return a test network request."""
184 return self._request
185
186
187class SSLErrorsTestCase(TestCase):
188 """Tests for when SSL errors happen."""
189
190 def test_handle_ssl_errors(self):
191 """Test the _handle_ssl_errors method."""
192 result = []
193 self.patch(qtnetwork.logger, "error", result.append)
194 client = qtnetwork.WebClient()
195 reply = FakeQNetworkReply()
196 errors = [QSslError()]
197 # pylint: disable=W0212
198 client._handle_ssl_errors(reply, errors)
199 # pylint: enable=W0212
200 self.assertTrue(type(result[0]), unicode)

Subscribers

People subscribed via source and target branches

to all changes: