Merge lp:~dbarth/ubuntu/raring/thin-client-config-agent/further-fix-1152222 into lp:ubuntu/raring/thin-client-config-agent

Proposed by David Barth
Status: Merged
Merge reported by: Dimitri John Ledkov
Merged at revision: not available
Proposed branch: lp:~dbarth/ubuntu/raring/thin-client-config-agent/further-fix-1152222
Merge into: lp:ubuntu/raring/thin-client-config-agent
Diff against target: 78 lines (+10/-9)
3 files modified
Makefile (+1/-1)
tccalib/__init__.py (+4/-4)
tccalib/tests/__init__.py (+5/-4)
To merge this branch: bzr merge lp:~dbarth/ubuntu/raring/thin-client-config-agent/further-fix-1152222
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Ubuntu branches Pending
Review via email: mp+156860@code.launchpad.net

Description of the change

Additional fixes on top of xnox's branch to solve the login problem and let all unit tests pass

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-08-14 16:02:35 +0000
3+++ Makefile 2013-04-03 14:20:36 +0000
4@@ -1,5 +1,5 @@
5 lint:
6 pyflakes $$(find -name '*.py') $$(grep '^#!.*python' $$(bzr ls -Vkfile) -l)
7 check:
8- python -m unittest tccalib.tests
9+ python3 -m unittest tccalib.tests
10 .PHONY: lint check
11
12=== modified file 'tccalib/__init__.py'
13--- tccalib/__init__.py 2012-08-15 21:46:51 +0000
14+++ tccalib/__init__.py 2013-04-03 14:20:36 +0000
15@@ -70,8 +70,8 @@
16 if _curl is None:
17 _curl = pycurl.Curl()
18 self.curl = _curl
19- self.result = StringIO()
20- self.response_header = StringIO()
21+ self.result = BytesIO()
22+ self.response_header = BytesIO()
23 self.curl.setopt(pycurl.HEADERFUNCTION, self.response_header.write)
24 self.curl.setopt(pycurl.WRITEFUNCTION, self.result.write)
25 self.verify_ssl = True
26@@ -125,9 +125,9 @@
27 raise
28 status = self.curl.getinfo(pycurl.HTTP_CODE)
29 if status == 200:
30- return self.result.getvalue()
31+ return self.result.getvalue().decode('utf-8')
32 else:
33- lines = self.response_header.getvalue().splitlines(True)
34+ lines = self.response_header.getvalue().decode('utf-8').splitlines(True)
35 header_ = ''.join(lines[1:])
36 headers = parse_headers(BytesIO(header_.encode('ascii')))
37 raise urllib.error.HTTPError(
38
39=== modified file 'tccalib/tests/__init__.py'
40--- tccalib/tests/__init__.py 2012-08-15 21:46:51 +0000
41+++ tccalib/tests/__init__.py 2013-04-03 14:20:36 +0000
42@@ -10,6 +10,7 @@
43 import base64
44
45 import pycurl
46+from io import BytesIO
47
48 from tccalib import (
49 CertificateVerificationFailed,
50@@ -125,8 +126,8 @@
51 self.options = {}
52 self.info = {}
53 self.response_status = response_status
54- self.response_header = header
55- self.response_body = body
56+ self.response_header = bytes(header, 'UTF-8')
57+ self.response_body = bytes(body, 'UTF-8')
58 self.effective_url=effective_url
59 self.perform_error = perform_error
60
61@@ -185,7 +186,7 @@
62 getter = PycURLGetter(curl)
63 output = getter.handle_response()
64 self.assertEqual('My body!', output)
65- self.assertEqual('My header!', getter.response_header.getvalue())
66+ self.assertEqual('My header!', getter.response_header.getvalue().decode('UTF-8'))
67 self.assertEqual('http://example.com/',
68 getter.curl.getinfo(pycurl.EFFECTIVE_URL))
69
70@@ -205,7 +206,7 @@
71 self.assertEqual("'HTTPError' object has no attribute 'url'",
72 str(attre))
73 self.assertEqual(500, httpe.getcode())
74- self.assertEqual('My body!', httpe.msg)
75+ self.assertEqual('My body!', httpe.msg.decode('UTF-8'))
76 self.assertEqual([('Content-type', 'fake')], httpe.hdrs.items())
77
78 def test_handle_response_connection_error(self):

Subscribers

People subscribed via source and target branches

to all changes: