Merge lp:~facundo/magicicada-protocol/xenial-tests into lp:magicicada-protocol

Proposed by Facundo Batista on 2016-09-19
Status: Merged
Approved by: Natalia Bidart on 2016-09-19
Approved revision: 168
Merged at revision: 167
Proposed branch: lp:~facundo/magicicada-protocol/xenial-tests
Merge into: lp:magicicada-protocol
Diff against target: 480 lines (+124/-83)
12 files modified
run-tests (+2/-2)
samples/easy_client.py (+3/-2)
samples/ping_client.py (+3/-3)
setup.py (+0/-2)
tests/certs/cert1.pem (+29/-0)
tests/certs/cert2.pem (+25/-0)
tests/test_client.py (+47/-38)
tests/test_context.py (+3/-27)
tests/test_proxy_tunnel.py (+1/-1)
ubuntuone/storageprotocol/client.py (+5/-5)
ubuntuone/storageprotocol/content_hash.py (+5/-1)
ubuntuone/storageprotocol/request.py (+1/-2)
To merge this branch: bzr merge lp:~facundo/magicicada-protocol/xenial-tests
Reviewer Review Type Date Requested Status
Natalia Bidart 2016-09-19 Approve on 2016-09-19
Review via email: mp+306051@code.launchpad.net

Commit message

Small changes for tests to run ok under xenial.

Description of the change

Small changes for tests to run ok under xenial.

Including:

- removed two tests that checked situations after having a protobuf message with an invalid value, and this is not possible anymore in modern protobuf (can not create the request itself, because of internal verifications at creation time).

- Stop patching the certificates loader, just set the proper env var in the test and use regular code. Also included the certificates in the project (previously they were being taken from SSO).

- Lot of aesthetic small details

To post a comment you must log in.
Natalia Bidart (nataliabidart) wrote :

Looks good! Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-tests'
2--- run-tests 2014-02-24 18:38:33 +0000
3+++ run-tests 2016-09-19 02:06:21 +0000
4@@ -21,11 +21,11 @@
5
6 /usr/bin/env python setup.py build
7 # run the tests with pure python protobuf
8-PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python u1trial tests
9+SSL_CERTIFICATES_DIR=tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python u1trial tests
10 if [ "$SYSNAME" != "Darwin" ]; then
11 # and with the cpp extension, for server (linux) only:
12 if [ $PROTOC_VERSION_AS_INT -lt 2500 ]; then
13- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp u1trial tests
14+ SSL_CERTIFICATES_DIR=tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp u1trial tests
15 fi
16 fi
17
18
19=== modified file 'samples/easy_client.py'
20--- samples/easy_client.py 2012-03-29 20:28:09 +0000
21+++ samples/easy_client.py 2016-09-19 02:06:21 +0000
22@@ -256,8 +256,9 @@
23 return failure
24
25
26-# deferred utilities
27-skip_result = lambda _, f, *args, **kwargs: f(*args, **kwargs)
28+def skip_result(_, f, *args, **kwargs):
29+ """Deferred utilities."""
30+ return f(*args, **kwargs)
31
32
33 def sr_result(result, f, *args, **kwargs):
34
35=== modified file 'samples/ping_client.py'
36--- samples/ping_client.py 2012-03-29 20:28:09 +0000
37+++ samples/ping_client.py 2016-09-19 02:06:21 +0000
38@@ -82,12 +82,12 @@
39 reactor.connectTCP('75.101.137.174', 80, PingClientFactory())
40
41 # using ssl
42- #reactor.connectSSL('localhost', 20101, StorageClientFactory(),
43+ # reactor.connectSSL('localhost', 20101, StorageClientFactory(),
44 # ssl.ClientContextFactory())
45
46 # using ssl over a proxy
47- #from ubuntuone.storageprotocol import proxy_tunnel
48- #proxy_tunnel.connectHTTPS('localhost', 3128,
49+ # from ubuntuone.storageprotocol import proxy_tunnel
50+ # proxy_tunnel.connectHTTPS('localhost', 3128,
51 # 'localhost', 20101, StorageClientFactory(),
52 # user="test", passwd="test")
53
54
55=== modified file 'setup.py'
56--- setup.py 2013-05-28 22:07:40 +0000
57+++ setup.py 2016-09-19 02:06:21 +0000
58@@ -21,8 +21,6 @@
59 import sys
60 import subprocess
61
62-sys.path.insert(0, os.path.abspath("."))
63-
64 from distutils.core import setup
65 from distutils.spawn import find_executable
66 from distutils.command import clean, build
67
68=== added directory 'tests/certs'
69=== added file 'tests/certs/cert1.pem'
70--- tests/certs/cert1.pem 1970-01-01 00:00:00 +0000
71+++ tests/certs/cert1.pem 2016-09-19 02:06:21 +0000
72@@ -0,0 +1,29 @@
73+-----BEGIN CERTIFICATE-----
74+MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVMx
75+ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
76+RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMTYw
77+MTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UECBMH
78+QXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5j
79+b20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j
80+b20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlcnRpZmlj
81+YXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJKoZIhvcN
82+AQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTtwY6vj3D3H
83+KrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqVTr9vcyOdQm
84+VZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aLGbqGmu75RpR
85+SgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo7RJlbmr2EkRT
86+cDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgWJCJjPOq8lh8BJ
87+6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAwEAAaOCATIwggEu
88+MB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVHSMEGDAWgBTSxLDS
89+kdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEAMDMGCCsGAQUFBwEB
90+BCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0f
91+BD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZXBv
92+c2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAAMDgwNgYIKwYBBQUH
93+AgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeTAO
94+BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IG
95+OgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ3kbTJSMU
96+A2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5CkKSkB2XIsKd83ASe8T+5o
97+0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTX
98+RE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH
99+qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sgVjOuH0aBsXBTWV
100+U+4=
101+-----END CERTIFICATE-----
102
103=== added file 'tests/certs/cert2.pem'
104--- tests/certs/cert2.pem 1970-01-01 00:00:00 +0000
105+++ tests/certs/cert2.pem 2016-09-19 02:06:21 +0000
106@@ -0,0 +1,25 @@
107+-----BEGIN CERTIFICATE-----
108+MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJV
109+UzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQL
110+EyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
111+DTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMx
112+ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMo
113+R28gRGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAw
114+DQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d
115+/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9
116+S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32qRe3H3I2
117+TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVl
118+OARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFA
119+pMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44
120+dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLEsNKR1EwRcbNh
121+yz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2oatTj
122+oWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdy
123+b3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj
124+YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF
125+BQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYX
126+MP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
127+I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheab
128+IZ0KbIIOqPjCDPoQHmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzr
129+Tia2cyvk0/ZM/iZx4mERdEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBD
130+pqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/bvZ8=
131+-----END CERTIFICATE-----
132
133=== modified file 'tests/test_client.py'
134--- tests/test_client.py 2015-05-18 17:23:03 +0000
135+++ tests/test_client.py 2016-09-19 02:06:21 +0000
136@@ -135,6 +135,10 @@
137 message.share.access_level = 0
138
139
140+def noop_callback(*a):
141+ """No op callback."""
142+
143+
144 class MethodMock(object):
145 """A class to overwrite methods to know if they were called.
146
147@@ -258,9 +262,8 @@
148
149 def test_set_volume_deleted_callback(self):
150 """Test callback setting."""
151- a_callback = lambda x: None
152- self.client.set_volume_deleted_callback(a_callback)
153- self.assertTrue(self.client._volume_deleted_callback is a_callback)
154+ self.client.set_volume_deleted_callback(noop_callback)
155+ self.assertTrue(self.client._volume_deleted_callback is noop_callback)
156
157 def test_callback_must_be_callable(self):
158 """Test set callback parameters."""
159@@ -275,31 +278,33 @@
160
161 def test_set_volume_created_callback(self):
162 """Test callback setting."""
163- a_callback = lambda y, z: None
164- self.client.set_volume_created_callback(a_callback)
165- self.assertTrue(self.client._volume_created_callback is a_callback)
166+ self.client.set_volume_created_callback(noop_callback)
167+ self.assertIs(self.client._volume_created_callback, noop_callback)
168
169 def test_set_volume_new_generation_callback(self):
170 """Test callback setting."""
171- cback = lambda y, z: None
172- self.client.set_volume_new_generation_callback(cback)
173- self.assertTrue(self.client._volume_new_generation_callback is cback)
174+ self.client.set_volume_new_generation_callback(noop_callback)
175+ self.assertIs(self.client._volume_new_generation_callback,
176+ noop_callback)
177
178 # share notification callbacks
179 def test_share_change_callback(self):
180 """Test share_change callback usage."""
181 self.assertRaises(TypeError, self.client.set_share_change_callback,
182 'hello')
183- #create a response and message
184+ # create a response and message
185 share_resp = sharersp.NotifyShareHolder.from_params(
186 uuid.uuid4(), uuid.uuid4(), 'sname', 'byu', 'tou', 'View')
187 proto_msg = protocol_pb2.Message()
188 proto_msg.type = protocol_pb2.Message.NOTIFY_SHARE
189 share_resp.dump_to_msg(proto_msg.notify_share)
190
191- #wire up a call back and make sure it's correct
192+ # wire up a call back and make sure it's correct
193 self.share_notif = None
194- a_callback = lambda notif: setattr(self, 'share_notif', notif)
195+
196+ def a_callback(notif):
197+ setattr(self, 'share_notif', notif)
198+
199 self.client.set_share_change_callback(a_callback)
200 self.assertTrue(self.client._share_change_callback is a_callback)
201 self.client.handle_NOTIFY_SHARE(proto_msg)
202@@ -315,9 +320,12 @@
203 proto_msg.type = protocol_pb2.Message.SHARE_DELETED
204 proto_msg.share_deleted.share_id = str(share_id)
205
206- #wire up a call back and make sure it's correct
207+ # wire up a call back and make sure it's correct
208 self.deleted_share_id = None
209- a_callback = lambda notif: setattr(self, 'deleted_share_id', notif)
210+
211+ def a_callback(notif):
212+ setattr(self, 'deleted_share_id', notif)
213+
214 self.client.set_share_delete_callback(a_callback)
215 self.assertTrue(self.client._share_delete_callback is a_callback)
216 self.client.handle_SHARE_DELETED(proto_msg)
217@@ -334,9 +342,12 @@
218 proto_msg.share_accepted.share_id = str(share_id)
219 proto_msg.share_accepted.answer = protocol_pb2.ShareAccepted.YES
220
221- #wire up a call back and make sure it's correct
222+ # wire up a call back and make sure it's correct
223 self.answer = None
224- a_callback = lambda s, a: setattr(self, 'answer', (s, a))
225+
226+ def a_callback(s, a):
227+ setattr(self, 'answer', (s, a))
228+
229 self.client.set_share_answer_callback(a_callback)
230 self.assertTrue(self.client._share_answer_callback is a_callback)
231 self.client.handle_SHARE_ACCEPTED(proto_msg)
232@@ -347,8 +358,8 @@
233 """Test handle_VOLUME_NEW_GENERATION with an uuid id."""
234 # set the callback to record the info
235 called = []
236- f = lambda *a: called.append(a)
237- self.client.set_volume_new_generation_callback(f)
238+ self.client.set_volume_new_generation_callback(
239+ lambda *a: called.append(a))
240
241 # create the message
242 message = protocol_pb2.Message()
243@@ -365,8 +376,8 @@
244 """Test handle_VOLUME_NEW_GENERATION for ROOT."""
245 # set the callback to record the info
246 called = []
247- f = lambda *a: called.append(a)
248- self.client.set_volume_new_generation_callback(f)
249+ self.client.set_volume_new_generation_callback(
250+ lambda *a: called.append(a))
251
252 # create the message
253 message = protocol_pb2.Message()
254@@ -393,7 +404,10 @@
255 def test_handle_root_created_passes_a_root(self):
256 """Test handle_VOLUME_CREATED parameter passing."""
257 self.volume = None
258- a_callback = lambda vol: setattr(self, 'volume', vol)
259+
260+ def a_callback(vol):
261+ setattr(self, 'volume', vol)
262+
263 self.client.set_volume_created_callback(a_callback)
264
265 message = build_volume_created()
266@@ -406,7 +420,10 @@
267 def test_handle_udf_created_passes_a_udf(self):
268 """Test handle_VOLUME_CREATED parameter passing."""
269 self.volume = None
270- a_callback = lambda vol: setattr(self, 'volume', vol)
271+
272+ def a_callback(vol):
273+ setattr(self, 'volume', vol)
274+
275 self.client.set_volume_created_callback(a_callback)
276
277 message = build_volume_created()
278@@ -419,7 +436,10 @@
279 def test_handle_share_created_passes_a_share(self):
280 """Test handle_VOLUME_CREATED parameter passing."""
281 self.volume = None
282- a_callback = lambda vol: setattr(self, 'volume', vol)
283+
284+ def a_callback(vol):
285+ setattr(self, 'volume', vol)
286+
287 self.client.set_volume_created_callback(a_callback)
288
289 message = build_volume_created()
290@@ -429,14 +449,6 @@
291 self.client.handle_VOLUME_CREATED(message)
292 self.assertEquals(share, self.volume)
293
294- def test_handle_volume_created_if_volume_is_buggy(self):
295- """Test handle_VOLUME_CREATED if the volume is buggy."""
296- message = build_volume_created()
297- message.volume_created.type = -1 # invalid type!
298- self.client.set_volume_created_callback(lambda vol: None)
299- self.assertRaises(TypeError, self.client.handle_VOLUME_CREATED,
300- message)
301-
302 def test_handle_volume_created_if_callback_is_none(self):
303 """Test handle_VOLUME_CREATED if callback is none."""
304 message = build_volume_created()
305@@ -456,7 +468,10 @@
306 def test_handle_volume_deleted_passes_the_id(self):
307 """Test handle_VOLUME_DELETED."""
308 self.volume = None
309- a_callback = lambda vol_id: setattr(self, 'volume', vol_id)
310+
311+ def a_callback(vol):
312+ setattr(self, 'volume', vol)
313+
314 self.client.set_volume_deleted_callback(a_callback)
315
316 message = build_volume_deleted()
317@@ -566,12 +581,6 @@
318 message = protocol_pb2.Message()
319 self.assertRaises(FakedError, self.request.processMessage, message)
320
321- def test_process_message_error_when_incorrect_volume(self):
322- """Test error condition when incorrect volume type."""
323- message = build_list_volumes()
324- message.list_volumes.type = -1
325- self.assertRaises(FakedError, self.request.processMessage, message)
326-
327 def test_process_message_volume_created(self):
328 """Test request processMessage on sucess."""
329 message = build_list_volumes()
330
331=== modified file 'tests/test_context.py'
332--- tests/test_context.py 2015-05-18 17:23:03 +0000
333+++ tests/test_context.py 2016-09-19 02:06:21 +0000
334@@ -36,12 +36,6 @@
335
336 from ubuntuone.storageprotocol import context
337
338-try:
339- from ubuntu_sso.utils import get_cert_dir
340-except ImportError:
341- # old system, let's support Precise
342- get_cert_dir = lambda: '/etc/ssl/certs'
343-
344
345 class FakeCerts(object):
346 """CA and Server certificate."""
347@@ -123,24 +117,6 @@
348 """Tests for the context.get_ssl_context function."""
349
350 @defer.inlineCallbacks
351- def setUp(self):
352- yield super(SSLContextTestCase, self).setUp()
353- self.patch(context, "get_certificates", self.get_certificates)
354-
355- def get_certificates(self):
356- """Get the uninstalled certificates, for testing."""
357- certs = []
358- data_dir = get_cert_dir()
359-
360- for certname in ['UbuntuOne-Go_Daddy_Class_2_CA.pem',
361- 'UbuntuOne-Go_Daddy_CA.pem']:
362- cert_path = os.path.abspath(os.path.join(data_dir, certname))
363- c = ssl.Certificate.loadPEM(file(cert_path, 'r').read())
364- certs.append(c.original)
365-
366- return certs
367-
368- @defer.inlineCallbacks
369 def verify_context(self, server_context, client_context):
370 """Verify a client context with a given server context."""
371 site = server.Site(FakeResource())
372@@ -177,7 +153,7 @@
373
374 d = self.verify_context(server_context, client_context)
375 e = yield self.assertFailure(d, SSL.Error)
376- self.assertEqual(e[0][0][1], "SSL3_GET_SERVER_CERTIFICATE")
377+ self.assertEqual(e[0][0][1], "ssl3_get_server_certificate")
378
379 @defer.inlineCallbacks
380 def test_fails_hostname(self):
381@@ -191,7 +167,7 @@
382
383 d = self.verify_context(server_context, client_context)
384 e = yield self.assertFailure(d, SSL.Error)
385- self.assertEqual(e[0][0][1], "SSL3_GET_SERVER_CERTIFICATE")
386+ self.assertEqual(e[0][0][1], "ssl3_get_server_certificate")
387
388 @defer.inlineCallbacks
389 def test_matches_all(self):
390@@ -212,7 +188,7 @@
391 def test_load_all_certificates(self):
392 """Load all available certificates."""
393 certs = FakeCerts(self, "localhost")
394- self.patch(context, 'get_cert_dir', lambda: certs.cert_dir)
395+ os.environ['SSL_CERTIFICATES_DIR'] = certs.cert_dir
396 # remove the key
397 os.unlink(certs.server_key_path)
398 loaded = context.get_certificates()
399
400=== modified file 'tests/test_proxy_tunnel.py'
401--- tests/test_proxy_tunnel.py 2012-03-29 20:28:09 +0000
402+++ tests/test_proxy_tunnel.py 2016-09-19 02:06:21 +0000
403@@ -135,7 +135,7 @@
404 if auth is not None:
405 auth_line = "Proxy-Authorization: Basic " + \
406 base64.b64encode("test:test")
407- if not auth_line in data:
408+ if auth_line not in data:
409 proto.dataReceived("HTTP/1.0 403 Forbidden\r\n\r\n")
410 else:
411 proto.dataReceived(response_string)
412
413=== modified file 'ubuntuone/storageprotocol/client.py'
414--- ubuntuone/storageprotocol/client.py 2015-05-18 17:23:03 +0000
415+++ ubuntuone/storageprotocol/client.py 2016-09-19 02:06:21 +0000
416@@ -1689,8 +1689,8 @@
417 """
418 delayed_call = getattr(self, call_id)
419 # check if we already have a DelayedCall running
420- if delayed_call is None or (not delayed_call.active()
421- and delayed_call.cancelled):
422+ if delayed_call is None or (
423+ not delayed_call.active() and delayed_call.cancelled):
424 return self.callLater(period, func)
425 return delayed_call
426
427@@ -1837,12 +1837,12 @@
428 reactor.connectTCP('localhost', 20100, StorageClientFactory())
429
430 # using ssl
431- #reactor.connectSSL('localhost', 20101, StorageClientFactory(),
432+ # reactor.connectSSL('localhost', 20101, StorageClientFactory(),
433 # ssl.ClientContextFactory())
434
435 # using ssl over a proxy
436- #from ubuntuone.storageprotocol import proxy_tunnel
437- #proxy_tunnel.connectHTTPS('localhost', 3128,
438+ # from ubuntuone.storageprotocol import proxy_tunnel
439+ # proxy_tunnel.connectHTTPS('localhost', 3128,
440 # 'localhost', 20101, StorageClientFactory(),
441 # user="test", passwd="test")
442
443
444=== modified file 'ubuntuone/storageprotocol/content_hash.py'
445--- ubuntuone/storageprotocol/content_hash.py 2012-03-29 20:28:09 +0000
446+++ ubuntuone/storageprotocol/content_hash.py 2016-09-19 02:06:21 +0000
447@@ -36,6 +36,10 @@
448 import zlib
449
450
451+def noop():
452+ """No op."""
453+
454+
455 class ContentHash(object):
456 """Encapsulate the generation of content hashes.
457
458@@ -43,7 +47,7 @@
459 composition to get similar methods.
460
461 """
462- method = lambda: None
463+ method = noop
464 method_name = ""
465
466 def __init__(self):
467
468=== modified file 'ubuntuone/storageprotocol/request.py'
469--- ubuntuone/storageprotocol/request.py 2013-08-01 21:32:53 +0000
470+++ ubuntuone/storageprotocol/request.py 2016-09-19 02:06:21 +0000
471@@ -214,8 +214,7 @@
472
473 if is_invalid:
474 self.log.error("Validation error: " + ", ".join(is_invalid))
475- comment = ("Validation error:\n"
476- + "\n".join(is_invalid))
477+ comment = "Validation error:\n" + "\n".join(is_invalid)
478 if len(comment) > MAX_PAYLOAD_SIZE - 100:
479 comment = comment[:MAX_PAYLOAD_SIZE - 112] + ' [truncated]'
480 error_message = protocol_pb2.Message()

Subscribers

People subscribed via source and target branches

to all changes: