Merge lp:~alecu/ubuntu-sso-client/fix-ssl-unicode into lp:ubuntu-sso-client

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Brian Curtin
Approved revision: 994
Merged at revision: 994
Proposed branch: lp:~alecu/ubuntu-sso-client/fix-ssl-unicode
Merge into: lp:ubuntu-sso-client
Prerequisite: lp:~brian.curtin/ubuntu-sso-client/py3-unicode-part-3
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:~alecu/ubuntu-sso-client/fix-ssl-unicode
Reviewer Review Type Date Requested Status
Brian Curtin (community) Approve
dobey (community) Approve
Review via email: mp+120013@code.launchpad.net

Commit message

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

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

Looks ok to me.

review: Approve
Revision history for this message
Brian Curtin (brian.curtin) :
review: Approve

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-16 20:41:20 +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-16 20:41:20 +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