Merge lp:~thisfred/ubuntuone-client/lp-732431 into lp:ubuntuone-client

Proposed by Eric Casteleijn
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 918
Merged at revision: 917
Proposed branch: lp:~thisfred/ubuntuone-client/lp-732431
Merge into: lp:ubuntuone-client
Diff against target: 89 lines (+19/-10)
3 files modified
tests/status/test_aggregator.py (+16/-6)
ubuntuone/platform/linux/messaging.py (+1/-1)
ubuntuone/status/aggregator.py (+2/-3)
To merge this branch: bzr merge lp:~thisfred/ubuntuone-client/lp-732431
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+52864@code.launchpad.net

Commit message

fixes bug #732431: a callback was called with the wrong signature, and no tests exercised it. Both are fixed now.

Description of the change

fixes bug #732431: a callback was called with the wrong signature, and no tests exercised it. Both are fixed now.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) :
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 2011-03-09 20:36:53 +0000
3+++ tests/status/test_aggregator.py 2011-03-10 14:57:35 +0000
4@@ -169,7 +169,7 @@
5 def __init__(self): # pylint: disable=W0231
6 self.messages_shown = {}
7 self.messages_updated = {}
8-
9+ self.callbacks = []
10 # pylint: disable=R0913
11 def show_message(self, sender, callback=None, message_time=None,
12 message_count=None, icon=None):
13@@ -184,6 +184,14 @@
14 """Update the count for an existing indicator."""
15 self.messages_updated[sender] = (sender, add_count)
16
17+ def _callback(self, indicator, message_time=None):
18+ """Fake callback."""
19+ self.callbacks.append((indicator, message_time))
20+
21+ def create_callback(self):
22+ """Create the callback."""
23+ return self._callback
24+
25
26 class FakeStatusAggregator(object):
27 """A fake status aggregator."""
28@@ -969,6 +977,10 @@
29 self.assertEqual(None, msg[1])
30 # msg did receive a count argument
31 self.assertEqual(1, msg[2])
32+ # call callback
33+ print msg
34+ msg[0]('fake_indicator')
35+ self.assertEqual(1, len(self.status_frontend.messaging.callbacks))
36
37 def test_two_new_udfs_available(self):
38 """A new udf is available for subscription."""
39@@ -1509,15 +1521,13 @@
40 status99,
41 status99,
42 FakeStatus(12),
43- FakeStatus(1),
44- ]
45+ FakeStatus(1)]
46
47- result = [ list(k) for j, k in aggregator.group_statuses(statuses) ]
48+ result = [list(k) for _, k in aggregator.group_statuses(statuses)]
49 expected = [
50 [statuses[3]],
51 [statuses[2]],
52- [status99, status99],
53- ]
54+ [status99, status99]]
55
56 self.assertEqual(result, expected)
57
58
59=== modified file 'ubuntuone/platform/linux/messaging.py'
60--- ubuntuone/platform/linux/messaging.py 2011-02-23 20:36:16 +0000
61+++ ubuntuone/platform/linux/messaging.py 2011-03-10 14:57:35 +0000
62@@ -90,7 +90,7 @@
63 return indicator
64 # pylint: enable=R0913
65
66- def create_callback(self, ):
67+ def create_callback(self):
68 """Create the callback to be used."""
69
70 def callback(indicator, message_time=None): # pylint: disable=W0613
71
72=== modified file 'ubuntuone/status/aggregator.py'
73--- ubuntuone/status/aggregator.py 2011-03-09 15:54:46 +0000
74+++ ubuntuone/status/aggregator.py 2011-03-10 14:57:35 +0000
75@@ -831,12 +831,11 @@
76 self.notification.send_notification(
77 UBUNTUONE_TITLE, UDFAvailableStatus(udf=udf).one())
78
79- # pylint: disable=W0613
80 def _reset_udf_message_callback(self, indicator, message_time=None):
81 """A callback wrapper that resets the udf_message to None."""
82 self.udf_message = None
83- self.messaging.create_callback()()
84- # pylint: enable=W0613
85+ callback = self.messaging.create_callback()
86+ callback(indicator, message_time=message_time)
87
88 def server_connection_lost(self):
89 """The client lost the connection to the server."""

Subscribers

People subscribed via source and target branches