Merge lp:~diegosarmentero/ubuntuone-client/deflated-size into lp:ubuntuone-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 1340
Merged at revision: 1341
Proposed branch: lp:~diegosarmentero/ubuntuone-client/deflated-size
Merge into: lp:ubuntuone-client
Prerequisite: lp:~diegosarmentero/ubuntuone-client/menulucid
Diff against target: 68 lines (+19/-6)
2 files modified
tests/status/test_aggregator.py (+17/-4)
ubuntuone/status/aggregator.py (+2/-2)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/deflated-size
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Mike McCracken (community) Approve
Review via email: mp+129215@code.launchpad.net

Commit message

- Using deflated_size instead of size (LP: #1062729).

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

Tests pass on ubuntu, and I know that this change works IRL on darwin, I tried it last Friday night.

review: Approve
Revision history for this message
Manuel de la Peña (mandel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/status/test_aggregator.py'
2--- tests/status/test_aggregator.py 2012-10-10 14:54:49 +0000
3+++ tests/status/test_aggregator.py 2012-10-11 15:12:23 +0000
4@@ -829,7 +829,7 @@
5 def test_file_uploading(self):
6 """Check that it returns a list with the path, size, and progress."""
7 fc = FakeCommand(path='testfile.txt')
8- fc.size = 200
9+ fc.deflated_size = 200
10 self.status_frontend.upload_started(fc)
11 uploading = self.status_frontend.files_uploading()
12 expected = [('testfile.txt', 200, 0)]
13@@ -838,10 +838,10 @@
14 self.assertEqual(menu_data,
15 {UPLOADING: expected, RECENT_TRANSFERS: []})
16
17- fc.size = 1000
18+ fc.deflated_size = 1000
19 fc.n_bytes_written = 200
20 fc2 = FakeCommand(path='testfile2.txt')
21- fc2.size = 2000
22+ fc2.deflated_size = 2000
23 fc2.n_bytes_written = 450
24 self.status_frontend.upload_started(fc2)
25 uploading = self.status_frontend.files_uploading()
26@@ -852,6 +852,19 @@
27 self.assertEqual(menu_data,
28 {UPLOADING: expected, RECENT_TRANSFERS: []})
29
30+ def test_files_uploading_empty(self):
31+ """Check that empty files are ignored."""
32+ fc = FakeCommand(path='testfile.txt')
33+ fc.deflated_size = None
34+ self.status_frontend.upload_started(fc)
35+
36+ fc2 = FakeCommand(path='testfile2.txt')
37+ fc2.deflated_size = 0
38+ fc2.n_bytes_written = 450
39+ self.status_frontend.upload_started(fc2)
40+ uploading = self.status_frontend.files_uploading()
41+ self.assertEqual(uploading, [])
42+
43 def test_menu_data_full_response(self):
44 """Check that listener.menu_data returns both uploading and recent."""
45 self.patch(status_listener.action_queue, "Upload", FakeCommand)
46@@ -859,7 +872,7 @@
47 self.listener.handle_SYS_QUEUE_ADDED(fake_command)
48 self.listener.handle_SYS_QUEUE_REMOVED(fake_command)
49 fc = FakeCommand(path='testfile.txt')
50- fc.size = 1000
51+ fc.deflated_size = 1000
52 fc.n_bytes_written = 200
53 self.status_frontend.upload_started(fc)
54 uploading = self.status_frontend.files_uploading()
55
56=== modified file 'ubuntuone/status/aggregator.py'
57--- ubuntuone/status/aggregator.py 2012-10-10 14:54:49 +0000
58+++ ubuntuone/status/aggregator.py 2012-10-11 15:12:23 +0000
59@@ -843,8 +843,8 @@
60 """Return a list with the files being uploading."""
61 uploading = []
62 for upload in self.aggregator.files_uploading:
63- if upload.size != 0:
64- uploading.append((upload.path, upload.size,
65+ if upload.deflated_size not in (0, None):
66+ uploading.append((upload.path, upload.deflated_size,
67 upload.n_bytes_written))
68 return uploading
69

Subscribers

People subscribed via source and target branches