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
1=== modified file 'ubuntu_sso/utils/webclient/qtnetwork.py'
2--- ubuntu_sso/utils/webclient/qtnetwork.py 2012-07-02 19:16:16 +0000
3+++ ubuntu_sso/utils/webclient/qtnetwork.py 2012-08-28 17:30:29 +0000
4@@ -28,6 +28,8 @@
5 # files in the program, then also delete it here.
6 """A webclient backend that uses QtNetwork."""
7
8+from __future__ import unicode_literals
9+
10 import sys
11 from io import StringIO
12
13
14=== modified file 'ubuntu_sso/utils/webclient/tests/test_qtnetwork.py'
15--- ubuntu_sso/utils/webclient/tests/test_qtnetwork.py 2012-04-09 17:38:24 +0000
16+++ ubuntu_sso/utils/webclient/tests/test_qtnetwork.py 2012-08-28 17:30:29 +0000
17@@ -28,6 +28,7 @@
18 # files in the program, then also delete it here.
19 """Specific tests for the qt implementation."""
20
21+from PyQt4.QtNetwork import QSslError
22 from twisted.internet import defer
23 from ubuntuone.devtools.testcases import TestCase
24
25@@ -168,3 +169,32 @@
26 self.assertNotEqual(self.proxy, qtnetwork.WebClient.proxy_instance)
27 self.assertNotIn(('systemProxyForQuery', self.query), self.called)
28 self.assertNotIn(('setApplicationProxy', self.proxy), self.called)
29+
30+
31+class FakeQNetworkReply(object):
32+ """A fake QNetworkReply."""
33+
34+ def __init__(self):
35+ """Initialize this fake."""
36+ url = qtnetwork.QUrl("http://fake_server")
37+ self._request = qtnetwork.QNetworkRequest(url)
38+
39+ def request(self):
40+ """Return a test network request."""
41+ return self._request
42+
43+
44+class SSLErrorsTestCase(TestCase):
45+ """Tests for when SSL errors happen."""
46+
47+ def test_handle_ssl_errors(self):
48+ """Test the _handle_ssl_errors method."""
49+ result = []
50+ self.patch(qtnetwork.logger, "error", result.append)
51+ client = qtnetwork.WebClient()
52+ reply = FakeQNetworkReply()
53+ errors = [QSslError()]
54+ # pylint: disable=W0212
55+ client._handle_ssl_errors(reply, errors)
56+ # pylint: enable=W0212
57+ self.assertTrue(type(result[0]), unicode)

Subscribers

People subscribed via source and target branches

to all changes: