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
=== modified file 'tests/status/test_aggregator.py'
--- tests/status/test_aggregator.py 2012-10-10 14:54:49 +0000
+++ tests/status/test_aggregator.py 2012-10-11 15:12:23 +0000
@@ -829,7 +829,7 @@
829 def test_file_uploading(self):829 def test_file_uploading(self):
830 """Check that it returns a list with the path, size, and progress."""830 """Check that it returns a list with the path, size, and progress."""
831 fc = FakeCommand(path='testfile.txt')831 fc = FakeCommand(path='testfile.txt')
832 fc.size = 200832 fc.deflated_size = 200
833 self.status_frontend.upload_started(fc)833 self.status_frontend.upload_started(fc)
834 uploading = self.status_frontend.files_uploading()834 uploading = self.status_frontend.files_uploading()
835 expected = [('testfile.txt', 200, 0)]835 expected = [('testfile.txt', 200, 0)]
@@ -838,10 +838,10 @@
838 self.assertEqual(menu_data,838 self.assertEqual(menu_data,
839 {UPLOADING: expected, RECENT_TRANSFERS: []})839 {UPLOADING: expected, RECENT_TRANSFERS: []})
840840
841 fc.size = 1000841 fc.deflated_size = 1000
842 fc.n_bytes_written = 200842 fc.n_bytes_written = 200
843 fc2 = FakeCommand(path='testfile2.txt')843 fc2 = FakeCommand(path='testfile2.txt')
844 fc2.size = 2000844 fc2.deflated_size = 2000
845 fc2.n_bytes_written = 450845 fc2.n_bytes_written = 450
846 self.status_frontend.upload_started(fc2)846 self.status_frontend.upload_started(fc2)
847 uploading = self.status_frontend.files_uploading()847 uploading = self.status_frontend.files_uploading()
@@ -852,6 +852,19 @@
852 self.assertEqual(menu_data,852 self.assertEqual(menu_data,
853 {UPLOADING: expected, RECENT_TRANSFERS: []})853 {UPLOADING: expected, RECENT_TRANSFERS: []})
854854
855 def test_files_uploading_empty(self):
856 """Check that empty files are ignored."""
857 fc = FakeCommand(path='testfile.txt')
858 fc.deflated_size = None
859 self.status_frontend.upload_started(fc)
860
861 fc2 = FakeCommand(path='testfile2.txt')
862 fc2.deflated_size = 0
863 fc2.n_bytes_written = 450
864 self.status_frontend.upload_started(fc2)
865 uploading = self.status_frontend.files_uploading()
866 self.assertEqual(uploading, [])
867
855 def test_menu_data_full_response(self):868 def test_menu_data_full_response(self):
856 """Check that listener.menu_data returns both uploading and recent."""869 """Check that listener.menu_data returns both uploading and recent."""
857 self.patch(status_listener.action_queue, "Upload", FakeCommand)870 self.patch(status_listener.action_queue, "Upload", FakeCommand)
@@ -859,7 +872,7 @@
859 self.listener.handle_SYS_QUEUE_ADDED(fake_command)872 self.listener.handle_SYS_QUEUE_ADDED(fake_command)
860 self.listener.handle_SYS_QUEUE_REMOVED(fake_command)873 self.listener.handle_SYS_QUEUE_REMOVED(fake_command)
861 fc = FakeCommand(path='testfile.txt')874 fc = FakeCommand(path='testfile.txt')
862 fc.size = 1000875 fc.deflated_size = 1000
863 fc.n_bytes_written = 200876 fc.n_bytes_written = 200
864 self.status_frontend.upload_started(fc)877 self.status_frontend.upload_started(fc)
865 uploading = self.status_frontend.files_uploading()878 uploading = self.status_frontend.files_uploading()
866879
=== modified file 'ubuntuone/status/aggregator.py'
--- ubuntuone/status/aggregator.py 2012-10-10 14:54:49 +0000
+++ ubuntuone/status/aggregator.py 2012-10-11 15:12:23 +0000
@@ -843,8 +843,8 @@
843 """Return a list with the files being uploading."""843 """Return a list with the files being uploading."""
844 uploading = []844 uploading = []
845 for upload in self.aggregator.files_uploading:845 for upload in self.aggregator.files_uploading:
846 if upload.size != 0:846 if upload.deflated_size not in (0, None):
847 uploading.append((upload.path, upload.size,847 uploading.append((upload.path, upload.deflated_size,
848 upload.n_bytes_written))848 upload.n_bytes_written))
849 return uploading849 return uploading
850850

Subscribers

People subscribed via source and target branches