Merge lp:~thisfred/ubuntuone-client/fix-stale-notification-3-0 into lp:ubuntuone-client/stable-3-0

Proposed by Eric Casteleijn
Status: Merged
Merge reported by: dobey
Merged at revision: not available
Proposed branch: lp:~thisfred/ubuntuone-client/fix-stale-notification-3-0
Merge into: lp:ubuntuone-client/stable-3-0
Diff against target: 73 lines (+28/-6)
2 files modified
tests/status/test_aggregator.py (+20/-0)
ubuntuone/status/aggregator.py (+8/-6)
To merge this branch: bzr merge lp:~thisfred/ubuntuone-client/fix-stale-notification-3-0
Reviewer Review Type Date Requested Status
Ubuntu One hackers Pending
Review via email: mp+85749@code.launchpad.net

Commit message

Uploading filename is now reset on every message display.

Description of the change

Uploading filename is now reset on every message display.

To post a comment you must log in.
1162. By Eric Casteleijn

unchanged: attach bug

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 2011-10-27 13:47:09 +0000
3+++ tests/status/test_aggregator.py 2011-12-14 21:28:24 +0000
4@@ -1327,6 +1327,26 @@
5 result = self.aggregator.get_discovery_message()
6 self.assertEqual(expected, result)
7
8+ def test_get_discovery_message_clears_filenames(self):
9+ """Test the message that's shown on the discovery bubble."""
10+ uploading = 10
11+ downloading = 8
12+ filename = 'upfile0.ext'
13+ filename2 = 'downfile0.ext'
14+ self.aggregator.files_uploading.extend([
15+ FakeCommand(path='upfile%d.ext' % n) for n in range(uploading)])
16+ self.aggregator.uploading_filename = filename
17+ self.aggregator.files_downloading.extend([
18+ FakeCommand(path='downfile%d.ext' % n) for n in
19+ range(downloading)])
20+ self.aggregator.downloading_filename = 'STALE FILENAME'
21+ self.aggregator.uploading_filename = 'STALE FILENAME'
22+ expected = (
23+ aggregator.files_being_uploaded(filename, uploading) + "\n" +
24+ aggregator.files_being_downloaded(filename2, downloading))
25+ result = self.aggregator.get_discovery_message()
26+ self.assertEqual(expected, result)
27+
28 def test_get_final_status_message(self):
29 """The final status message."""
30 done = (5, 10)
31
32=== modified file 'ubuntuone/status/aggregator.py'
33--- ubuntuone/status/aggregator.py 2011-10-21 15:49:18 +0000
34+++ ubuntuone/status/aggregator.py 2011-12-14 21:28:24 +0000
35@@ -646,12 +646,14 @@
36 lines = []
37 files_uploading = len(self.files_uploading)
38 if files_uploading > 0:
39+ self.uploading_filename = os.path.basename(
40+ self.files_uploading[0].path)
41 lines.append(files_being_uploaded(
42 self.uploading_filename, files_uploading))
43 files_downloading = len(self.files_downloading)
44 if files_downloading > 0:
45- self.downloading_filename = self.files_downloading[0].path.split(
46- os.path.sep)[-1]
47+ self.downloading_filename = os.path.basename(
48+ self.files_downloading[0].path)
49 lines.append(files_being_downloaded(
50 self.downloading_filename, files_downloading))
51 return "\n".join(lines)
52@@ -712,8 +714,8 @@
53 (command.share_id, command.node_id)] = command.deflated_size
54 # pylint: disable=W0201
55 if not self.downloading_filename:
56- self.downloading_filename = self.files_downloading[0].path.split(
57- os.path.sep)[-1]
58+ self.downloading_filename = os.path.basename(
59+ self.files_downloading[0].path)
60 # pylint: enable=W0201
61 self.update_progressbar()
62 logger.debug(
63@@ -743,8 +745,8 @@
64 (command.share_id, command.node_id)] = command.deflated_size
65 # pylint: disable=W0201
66 if not self.uploading_filename:
67- self.uploading_filename = self.files_uploading[0].path.split(
68- os.path.sep)[-1]
69+ self.uploading_filename = os.path.basename(
70+ self.files_uploading[0].path)
71 # pylint: enable=W0201
72 self.update_progressbar()
73 logger.debug(

Subscribers

People subscribed via source and target branches