Merge lp:~robru/friends/neuter into lp:friends

Proposed by Robert Bruce Park
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 259
Merged at revision: 256
Proposed branch: lp:~robru/friends/neuter
Merge into: lp:friends
Diff against target: 156 lines (+65/-0)
2 files modified
friends/service/dispatcher.py (+23/-0)
friends/tests/test_dispatcher.py (+42/-0)
To merge this branch: bzr merge lp:~robru/friends/neuter
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Ken VanDine Pending
Super Friends Pending
Review via email: mp+226724@code.launchpad.net

Commit message

Neuter friends-dispatcher so that no messages can be sent or received.

To post a comment you must log in.
lp:~robru/friends/neuter updated
257. By Robert Bruce Park

Fix tests too

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Robert Bruce Park (robru) wrote :

I don't understand this jenkins failure and I can't reproduce it locally

lp:~robru/friends/neuter updated
258. By Robert Bruce Park

Call success callback for async methods.

259. By Robert Bruce Park

Pass an argument to success()

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:259
http://jenkins.qa.ubuntu.com/job/friends-ci/60/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/friends-utopic-amd64-ci/3

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/friends-ci/60/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'friends/service/dispatcher.py'
2--- friends/service/dispatcher.py 2013-06-18 22:00:44 +0000
3+++ friends/service/dispatcher.py 2014-07-14 20:30:39 +0000
4@@ -119,6 +119,10 @@
5
6 log.debug('Refresh requested')
7
8+ # Friends is deprecated, the API is exposed for compatibility,
9+ # but calling the methods does nothing.
10+ return
11+
12 # account.protocol() starts a new thread and then returns
13 # immediately, so there is no delay or blocking during the
14 # execution of this method.
15@@ -162,6 +166,10 @@
16 service.Do('search', '', 'search terms') # Searches all accounts.
17 service.Do('list', '6', 'list_id') # Fetch a single list.
18 """
19+ # Friends is deprecated, the API is exposed for compatibility,
20+ # but calling the methods does nothing.
21+ return
22+
23 if account_id:
24 accounts = [self.accounts.get(int(account_id))]
25 if None in accounts:
26@@ -202,6 +210,11 @@
27 service = dbus.Interface(obj, DBUS_INTERFACE)
28 service.SendMessage('Your message')
29 """
30+ # Friends is deprecated, the API is exposed for compatibility,
31+ # but calling the methods does nothing.
32+ success('Warning: Friends is deprecated and has been disabled.')
33+ return
34+
35 sent = False
36 for account in self.accounts.values():
37 if account.send_enabled:
38@@ -237,6 +250,11 @@
39 service = dbus.Interface(obj, DBUS_INTERFACE)
40 service.SendReply('6', '34245645347345626', 'Your reply')
41 """
42+ # Friends is deprecated, the API is exposed for compatibility,
43+ # but calling the methods does nothing.
44+ success('Warning: Friends is deprecated and has been disabled.')
45+ return
46+
47 log.debug('Replying to {}, {}'.format(account_id, message_id))
48 account = self.accounts.get(int(account_id))
49 if account is not None:
50@@ -295,6 +313,11 @@
51 Note also that the callbacks are actually optional; you are
52 free to ignore error conditions at your peril.
53 """
54+ # Friends is deprecated, the API is exposed for compatibility,
55+ # but calling the methods does nothing.
56+ success('Warning: Friends is deprecated and has been disabled.')
57+ return
58+
59 log.debug('Uploading {} to {}'.format(uri, account_id))
60 account = self.accounts.get(int(account_id))
61 if account is not None:
62
63=== modified file 'friends/tests/test_dispatcher.py'
64--- friends/tests/test_dispatcher.py 2013-12-09 18:35:39 +0000
65+++ friends/tests/test_dispatcher.py 2014-07-14 20:30:39 +0000
66@@ -62,6 +62,12 @@
67
68 self.assertIsNone(self.dispatcher.Refresh())
69
70+ # Friends is deprecated, the API is exposed for compatibility,
71+ # but calling the methods does nothing.
72+ assert not self.dispatcher.accounts.values.called
73+ assert not account.protocol.called
74+ return
75+
76 self.dispatcher.accounts.values.assert_called_once_with()
77 account.protocol.assert_called_once_with('receive')
78
79@@ -82,6 +88,12 @@
80 self.dispatcher.accounts.get.return_value = account
81
82 self.dispatcher.Do('like', '345', '23346356767354626')
83+
84+ # Friends is deprecated, the API is exposed for compatibility,
85+ # but calling the methods does nothing.
86+ assert not self.dispatcher.accounts.get.called
87+ return
88+
89 self.dispatcher.accounts.get.assert_called_once_with(345)
90 account.protocol.assert_called_once_with(
91 'like', '23346356767354626', success=STUB, failure=STUB)
92@@ -97,6 +109,12 @@
93 self.dispatcher.accounts.get.return_value = None
94
95 self.dispatcher.Do('unlike', '6', '23346356767354626')
96+
97+ # Friends is deprecated, the API is exposed for compatibility,
98+ # but calling the methods does nothing.
99+ assert not self.dispatcher.accounts.get.called
100+ return
101+
102 self.dispatcher.accounts.get.assert_called_once_with(6)
103 self.assertEqual(account.protocol.call_count, 0)
104
105@@ -119,6 +137,12 @@
106 ]
107
108 self.dispatcher.SendMessage('Howdy friends!')
109+
110+ # Friends is deprecated, the API is exposed for compatibility,
111+ # but calling the methods does nothing.
112+ assert not self.dispatcher.accounts.values.called
113+ return
114+
115 self.dispatcher.accounts.values.assert_called_once_with()
116 account1.protocol.assert_called_once_with(
117 'send', 'Howdy friends!', success=STUB, failure=STUB)
118@@ -132,6 +156,12 @@
119 self.dispatcher.accounts.get.return_value = account
120
121 self.dispatcher.SendReply('2', 'objid', '[Hilarious Response]')
122+
123+ # Friends is deprecated, the API is exposed for compatibility,
124+ # but calling the methods does nothing.
125+ assert not self.dispatcher.accounts.get.called
126+ return
127+
128 self.dispatcher.accounts.get.assert_called_once_with(2)
129 account.protocol.assert_called_once_with(
130 'send_thread', 'objid', '[Hilarious Response]',
131@@ -148,6 +178,12 @@
132 self.dispatcher.accounts.get.return_value = None
133
134 self.dispatcher.SendReply('2', 'objid', '[Hilarious Response]')
135+
136+ # Friends is deprecated, the API is exposed for compatibility,
137+ # but calling the methods does nothing.
138+ assert not self.dispatcher.accounts.get.called
139+ return
140+
141 self.dispatcher.accounts.get.assert_called_once_with(2)
142 self.assertEqual(account.protocol.call_count, 0)
143
144@@ -170,6 +206,12 @@
145 'A thousand words',
146 success=success,
147 failure=failure)
148+
149+ # Friends is deprecated, the API is exposed for compatibility,
150+ # but calling the methods does nothing.
151+ assert not self.dispatcher.accounts.get.called
152+ return
153+
154 self.dispatcher.accounts.get.assert_called_once_with(2)
155 account.protocol.assert_called_once_with(
156 'upload',

Subscribers

People subscribed via source and target branches