Merge lp:~facundo/magicicada-gui/show-md into lp:magicicada-gui
- show-md
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Natalia Bidart | ||||
Approved revision: | 44 | ||||
Merged at revision: | 47 | ||||
Proposed branch: | lp:~facundo/magicicada-gui/show-md | ||||
Merge into: | lp:magicicada-gui | ||||
Diff against target: |
348 lines (+123/-24) 4 files modified
magicicada/dbusiface.py (+30/-3) magicicada/syncdaemon.py (+9/-0) magicicada/tests/test_dbusiface.py (+49/-13) magicicada/tests/test_syncdaemon.py (+35/-8) |
||||
To merge this branch: | bzr merge lp:~facundo/magicicada-gui/show-md | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart | Approve | ||
Review via email: mp+27406@code.launchpad.net |
Commit message
Description of the change
Get and deliver metadata for a given path
Natalia Bidart (nataliabidart) wrote : | # |
I was just thinking... what if the "code" for syncdaemon.
I just realized this when implementing the GUI part. Let me know what you think.
Natalia Bidart (nataliabidart) wrote : | # |
2 more things are needed:
(a) Could you please return a python dictionary instead a dbus dictionary? I'd want to keep dbus out the GTK layer.
(b) If the path doesn't exist, we'd need a special value, not a string saying "Not a valid path". This way we can ease the future translations, and we can detect this special case in a proper way.
Facundo Batista (facundo) wrote : | # |
After talking through IRC, what will do is:
- Will use "path" itself as the "code".
- The constant used in dbusiface.py in case of no path will be NOT_SYNCHED_PATH
- Will return a Py dict, instead a str
- 44. By Facundo Batista
-
Some docstring fixes and small changes.
Facundo Batista (facundo) wrote : | # |
I just make it to return the DBus types to the GUI.
Naty does not want it, but I thought duck typing should work... even thinking that, I tried to make tests to check that the types were converted, but...
>>> isinstance(
True
and
>>> isinstance(
True
So, actually, it would be too tough and too fake to assert that, and it should work rightaway.
Preview Diff
1 | === modified file 'magicicada/dbusiface.py' | |||
2 | --- magicicada/dbusiface.py 2010-06-05 15:57:34 +0000 | |||
3 | +++ magicicada/dbusiface.py 2010-06-14 18:14:25 +0000 | |||
4 | @@ -50,11 +50,19 @@ | |||
5 | 50 | "(Move)\(share_id=(.*?), node_id=(.*?), old_parent_id=(.*?), " | 50 | "(Move)\(share_id=(.*?), node_id=(.*?), old_parent_id=(.*?), " |
6 | 51 | "new_parent_id=(.*?), new_name=(.*?)\)") | 51 | "new_parent_id=(.*?), new_name=(.*?)\)") |
7 | 52 | 52 | ||
8 | 53 | # DBus exceptions store the type inside, as a string :| | ||
9 | 54 | DBUSERR_NOREPLY = 'org.freedesktop.DBus.Error.NoReply' | ||
10 | 55 | DBUSERR_NAMENOOWNER = 'org.freedesktop.DBus.Error.NameHasNoOwner' | ||
11 | 56 | DBUSERR_PYKEYERROR = 'org.freedesktop.DBus.Python.KeyError' | ||
12 | 57 | |||
13 | 58 | # some constants | ||
14 | 59 | NOT_SYNCHED_PATH = "Not a valid path!" | ||
15 | 60 | |||
16 | 53 | 61 | ||
17 | 54 | def _is_retry_exception(err): | 62 | def _is_retry_exception(err): |
18 | 55 | """Check if the exception is a retry one.""" | 63 | """Check if the exception is a retry one.""" |
19 | 56 | if isinstance(err, dbus.exceptions.DBusException): | 64 | if isinstance(err, dbus.exceptions.DBusException): |
21 | 57 | if err.get_dbus_name() == 'org.freedesktop.DBus.Error.NoReply': | 65 | if err.get_dbus_name() == DBUSERR_NOREPLY: |
22 | 58 | return True | 66 | return True |
23 | 59 | return False | 67 | return False |
24 | 60 | 68 | ||
25 | @@ -323,8 +331,7 @@ | |||
26 | 323 | try: | 331 | try: |
27 | 324 | self._bus.get_name_owner('com.ubuntuone.SyncDaemon') | 332 | self._bus.get_name_owner('com.ubuntuone.SyncDaemon') |
28 | 325 | except dbus.exceptions.DBusException, err: | 333 | except dbus.exceptions.DBusException, err: |
31 | 326 | if err.get_dbus_name() != \ | 334 | if err.get_dbus_name() != DBUSERR_NAMENOOWNER: |
30 | 327 | 'org.freedesktop.DBus.Error.NameHasNoOwner': | ||
32 | 328 | raise | 335 | raise |
33 | 329 | started = False | 336 | started = False |
34 | 330 | else: | 337 | else: |
35 | @@ -381,3 +388,23 @@ | |||
36 | 381 | d = self.sync_daemon_tool.list_shared() | 388 | d = self.sync_daemon_tool.list_shared() |
37 | 382 | d.addCallback(process) | 389 | d.addCallback(process) |
38 | 383 | return d | 390 | return d |
39 | 391 | |||
40 | 392 | @retryable | ||
41 | 393 | def get_metadata(self, path): | ||
42 | 394 | """Return the raw metadata.""" | ||
43 | 395 | logger.info("Getting metadata for %r", path) | ||
44 | 396 | |||
45 | 397 | def fix_failure(failure): | ||
46 | 398 | """Get the failure and return a nice message.""" | ||
47 | 399 | if failure.check(dbus.exceptions.DBusException): | ||
48 | 400 | if failure.value.get_dbus_name() == DBUSERR_PYKEYERROR: | ||
49 | 401 | return NOT_SYNCHED_PATH | ||
50 | 402 | return failure | ||
51 | 403 | |||
52 | 404 | def process(metadata): | ||
53 | 405 | logger.debug("Got metadata for path %r: %r", path, metadata) | ||
54 | 406 | return dict(metadata) | ||
55 | 407 | |||
56 | 408 | d = self.sync_daemon_tool.get_metadata(path) | ||
57 | 409 | d.addCallbacks(process, fix_failure) | ||
58 | 410 | return d | ||
59 | 384 | 411 | ||
60 | === modified file 'magicicada/syncdaemon.py' | |||
61 | --- magicicada/syncdaemon.py 2010-06-11 20:09:11 +0000 | |||
62 | +++ magicicada/syncdaemon.py 2010-06-14 18:14:25 +0000 | |||
63 | @@ -104,6 +104,7 @@ | |||
64 | 104 | self.on_folders_changed_callback = NO_OP | 104 | self.on_folders_changed_callback = NO_OP |
65 | 105 | self.on_shares_to_me_changed_callback = NO_OP | 105 | self.on_shares_to_me_changed_callback = NO_OP |
66 | 106 | self.on_shares_to_others_changed_callback = NO_OP | 106 | self.on_shares_to_others_changed_callback = NO_OP |
67 | 107 | self.on_metadata_ready_callback = None # mandatory | ||
68 | 107 | 108 | ||
69 | 108 | # mq needs to be polled to know progress | 109 | # mq needs to be polled to know progress |
70 | 109 | self._mqcaller = None | 110 | self._mqcaller = None |
71 | @@ -282,3 +283,11 @@ | |||
72 | 282 | """Tell the SyncDaemon that the user wants it to disconnect.""" | 283 | """Tell the SyncDaemon that the user wants it to disconnect.""" |
73 | 283 | logger.info("Telling u1.SD to disconnect") | 284 | logger.info("Telling u1.SD to disconnect") |
74 | 284 | self.dbus.disconnect() | 285 | self.dbus.disconnect() |
75 | 286 | |||
76 | 287 | def get_metadata(self, path): | ||
77 | 288 | """Get the metadata for given path.""" | ||
78 | 289 | if self.on_metadata_ready_callback is None: | ||
79 | 290 | raise ValueError("Missing the mandatory cback for get_metadata.") | ||
80 | 291 | |||
81 | 292 | d = self.dbus.get_metadata(path) | ||
82 | 293 | d.addCallback(lambda resp: self.on_metadata_ready_callback(path, resp)) | ||
83 | 285 | 294 | ||
84 | === modified file 'magicicada/tests/test_dbusiface.py' | |||
85 | --- magicicada/tests/test_dbusiface.py 2010-06-03 03:58:02 +0000 | |||
86 | +++ magicicada/tests/test_dbusiface.py 2010-06-14 18:14:25 +0000 | |||
87 | @@ -43,7 +43,7 @@ | |||
88 | 43 | del self._callbacks[(dbus_interface, signal_name)] | 43 | del self._callbacks[(dbus_interface, signal_name)] |
89 | 44 | 44 | ||
90 | 45 | def get_name_owner(self, name): | 45 | def get_name_owner(self, name): |
92 | 46 | """Fakes the response of the method.""" | 46 | """Fake the response of the method.""" |
93 | 47 | assert name == 'com.ubuntuone.SyncDaemon' | 47 | assert name == 'com.ubuntuone.SyncDaemon' |
94 | 48 | if isinstance(self.fake_name_owner, str): | 48 | if isinstance(self.fake_name_owner, str): |
95 | 49 | return self.fake_name_owner | 49 | return self.fake_name_owner |
96 | @@ -69,7 +69,10 @@ | |||
97 | 69 | return defer.Deferred() | 69 | return defer.Deferred() |
98 | 70 | methname, response = self._fake_response | 70 | methname, response = self._fake_response |
99 | 71 | assert methname == name | 71 | assert methname == name |
101 | 72 | return response | 72 | if isinstance(response, Exception): |
102 | 73 | return defer.fail(response) | ||
103 | 74 | else: | ||
104 | 75 | return defer.succeed(response) | ||
105 | 73 | return f | 76 | return f |
106 | 74 | 77 | ||
107 | 75 | 78 | ||
108 | @@ -104,9 +107,8 @@ | |||
109 | 104 | return called_args | 107 | return called_args |
110 | 105 | 108 | ||
111 | 106 | def fake_sdt_response(self, method_name, response): | 109 | def fake_sdt_response(self, method_name, response): |
115 | 107 | """Fakes SDT answer in deferred mode.""" | 110 | """Fake SDT answer in deferred mode.""" |
116 | 108 | self.dbus.sync_daemon_tool._fake_response = (method_name, | 111 | self.dbus.sync_daemon_tool._fake_response = (method_name, response) |
114 | 109 | defer.succeed(response)) | ||
117 | 110 | 112 | ||
118 | 111 | class TestSignalHooking(SafeTests): | 113 | class TestSignalHooking(SafeTests): |
119 | 112 | """Signal hooking tests. | 114 | """Signal hooking tests. |
120 | @@ -188,7 +190,7 @@ | |||
121 | 188 | 190 | ||
122 | 189 | 191 | ||
123 | 190 | class TestDataProcessingStatus(SafeTests): | 192 | class TestDataProcessingStatus(SafeTests): |
125 | 191 | """Processes Status before sending it to SyncDaemon.""" | 193 | """Process Status before sending it to SyncDaemon.""" |
126 | 192 | 194 | ||
127 | 193 | @defer.inlineCallbacks | 195 | @defer.inlineCallbacks |
128 | 194 | def test_get_status(self): | 196 | def test_get_status(self): |
129 | @@ -224,7 +226,7 @@ | |||
130 | 224 | 226 | ||
131 | 225 | 227 | ||
132 | 226 | class TestDataProcessingNameOwner(SafeTests): | 228 | class TestDataProcessingNameOwner(SafeTests): |
134 | 227 | """Processes Name Owner data before sending it to SyncDaemon.""" | 229 | """Process Name Owner data before sending it to SyncDaemon.""" |
135 | 228 | 230 | ||
136 | 229 | def test_name_owner_changed_no_syncdaemon(self): | 231 | def test_name_owner_changed_no_syncdaemon(self): |
137 | 230 | """Test name owner changed callback.""" | 232 | """Test name owner changed callback.""" |
138 | @@ -245,7 +247,7 @@ | |||
139 | 245 | 247 | ||
140 | 246 | 248 | ||
141 | 247 | class TestDataProcessingCQ(SafeTests): | 249 | class TestDataProcessingCQ(SafeTests): |
143 | 248 | """Processes CQ data before sending it to SyncDaemon.""" | 250 | """Process CQ data before sending it to SyncDaemon.""" |
144 | 249 | 251 | ||
145 | 250 | @defer.inlineCallbacks | 252 | @defer.inlineCallbacks |
146 | 251 | def test_nodata(self): | 253 | def test_nodata(self): |
147 | @@ -288,7 +290,7 @@ | |||
148 | 288 | 290 | ||
149 | 289 | 291 | ||
150 | 290 | class TestDataProcessingMQ(SafeTests): | 292 | class TestDataProcessingMQ(SafeTests): |
152 | 291 | """Processes MQ data before sending it to SyncDaemon.""" | 293 | """Process MQ data before sending it to SyncDaemon.""" |
153 | 292 | 294 | ||
154 | 293 | @defer.inlineCallbacks | 295 | @defer.inlineCallbacks |
155 | 294 | def test_nodata(self): | 296 | def test_nodata(self): |
156 | @@ -463,7 +465,7 @@ | |||
157 | 463 | 465 | ||
158 | 464 | 466 | ||
159 | 465 | class TestDataProcessingFolders(SafeTests): | 467 | class TestDataProcessingFolders(SafeTests): |
161 | 466 | """Processes Folders data before sending it to SyncDaemon.""" | 468 | """Process Folders data before sending it to SyncDaemon.""" |
162 | 467 | 469 | ||
163 | 468 | @defer.inlineCallbacks | 470 | @defer.inlineCallbacks |
164 | 469 | def test_nodata(self): | 471 | def test_nodata(self): |
165 | @@ -521,9 +523,29 @@ | |||
166 | 521 | self.get_msd_called("on_sd_folders_changed") | 523 | self.get_msd_called("on_sd_folders_changed") |
167 | 522 | 524 | ||
168 | 523 | 525 | ||
169 | 526 | class TestDataProcessingMetadata(SafeTests): | ||
170 | 527 | """Process Metadata data before sending it to SyncDaemon.""" | ||
171 | 528 | |||
172 | 529 | @defer.inlineCallbacks | ||
173 | 530 | def test_info_ok(self): | ||
174 | 531 | """Test get metadata and see response.""" | ||
175 | 532 | md = dbus.Dictionary({'a': 3, 'c': 4}, signature=dbus.Signature('ss')) | ||
176 | 533 | self.fake_sdt_response('get_metadata', md) | ||
177 | 534 | rcv = yield self.dbus.get_metadata('path') | ||
178 | 535 | self.assertEqual(rcv, dict(a=3, c=4)) | ||
179 | 536 | |||
180 | 537 | @defer.inlineCallbacks | ||
181 | 538 | def test_info_bad(self): | ||
182 | 539 | """Test get metadata and get the error.""" | ||
183 | 540 | exc = dbus.exceptions.DBusException( | ||
184 | 541 | name='org.freedesktop.DBus.Python.KeyError') | ||
185 | 542 | self.fake_sdt_response('get_metadata', exc) | ||
186 | 543 | rcv = yield self.dbus.get_metadata('not a real path') | ||
187 | 544 | self.assertEqual(rcv, dbusiface.NOT_SYNCHED_PATH) | ||
188 | 545 | |||
189 | 524 | 546 | ||
190 | 525 | class TestDataProcessingShares(SafeTests): | 547 | class TestDataProcessingShares(SafeTests): |
192 | 526 | """Processes Shares data before sending it to SyncDaemon.""" | 548 | """Process Shares data before sending it to SyncDaemon.""" |
193 | 527 | 549 | ||
194 | 528 | @defer.inlineCallbacks | 550 | @defer.inlineCallbacks |
195 | 529 | def test_sharestome_nodata(self): | 551 | def test_sharestome_nodata(self): |
196 | @@ -720,6 +742,11 @@ | |||
197 | 720 | self.dbus.get_folders() | 742 | self.dbus.get_folders() |
198 | 721 | self.assertTrue(self.handler.check_inf("Getting folders")) | 743 | self.assertTrue(self.handler.check_inf("Getting folders")) |
199 | 722 | 744 | ||
200 | 745 | def test_get_metadata(self): | ||
201 | 746 | """Test call to metadata.""" | ||
202 | 747 | self.dbus.get_metadata('path') | ||
203 | 748 | self.assertTrue(self.handler.check_inf("Getting metadata for u'path'")) | ||
204 | 749 | |||
205 | 723 | def test_get_shares_to_me(self): | 750 | def test_get_shares_to_me(self): |
206 | 724 | """Test call to shares to me.""" | 751 | """Test call to shares to me.""" |
207 | 725 | self.dbus.get_shares_to_me() | 752 | self.dbus.get_shares_to_me() |
208 | @@ -847,6 +874,15 @@ | |||
209 | 847 | self.assertTrue(self.handler.check_dbg(" Folders data: %r" % d)) | 874 | self.assertTrue(self.handler.check_dbg(" Folders data: %r" % d)) |
210 | 848 | 875 | ||
211 | 849 | @defer.inlineCallbacks | 876 | @defer.inlineCallbacks |
212 | 877 | def test_metadata_processing(self): | ||
213 | 878 | """Test get metadata.""" | ||
214 | 879 | d = dict(lot_of_data="I don't care") | ||
215 | 880 | self.fake_sdt_response('get_metadata', d) | ||
216 | 881 | yield self.dbus.get_metadata('path') | ||
217 | 882 | self.assertTrue(self.handler.check_dbg( | ||
218 | 883 | "Got metadata for path u'path': %r" % d)) | ||
219 | 884 | |||
220 | 885 | @defer.inlineCallbacks | ||
221 | 850 | def test_sharestome_processing(self): | 886 | def test_sharestome_processing(self): |
222 | 851 | """Test get shares to me with one.""" | 887 | """Test get shares to me with one.""" |
223 | 852 | d = dict(accepted=u'True', access_level=u'View', free_bytes=u'123456', | 888 | d = dict(accepted=u'True', access_level=u'View', free_bytes=u'123456', |
224 | @@ -877,7 +913,7 @@ | |||
225 | 877 | """Test the retry decorator.""" | 913 | """Test the retry decorator.""" |
226 | 878 | 914 | ||
227 | 879 | class Helper(object): | 915 | class Helper(object): |
229 | 880 | """Fails some times, finally succeeds.""" | 916 | """Fail some times, finally succeed.""" |
230 | 881 | def __init__(self, limit, excep=None): | 917 | def __init__(self, limit, excep=None): |
231 | 882 | self.cant = 0 | 918 | self.cant = 0 |
232 | 883 | self.limit = limit | 919 | self.limit = limit |
233 | @@ -915,7 +951,7 @@ | |||
234 | 915 | self.assertTrue(dbusiface._is_retry_exception(err)) | 951 | self.assertTrue(dbusiface._is_retry_exception(err)) |
235 | 916 | 952 | ||
236 | 917 | def get_decorated_func(self, func): | 953 | def get_decorated_func(self, func): |
238 | 918 | """Executes the test calling the received function.""" | 954 | """Execute the test calling the received function.""" |
239 | 919 | 955 | ||
240 | 920 | @dbusiface.retryable | 956 | @dbusiface.retryable |
241 | 921 | def f(): | 957 | def f(): |
242 | 922 | 958 | ||
243 | === modified file 'magicicada/tests/test_syncdaemon.py' | |||
244 | --- magicicada/tests/test_syncdaemon.py 2010-06-11 20:09:11 +0000 | |||
245 | +++ magicicada/tests/test_syncdaemon.py 2010-06-14 18:14:25 +0000 | |||
246 | @@ -133,7 +133,7 @@ | |||
247 | 133 | 133 | ||
248 | 134 | @defer.inlineCallbacks | 134 | @defer.inlineCallbacks |
249 | 135 | def test_initial_value(self): | 135 | def test_initial_value(self): |
251 | 136 | """Fills the status info initially.""" | 136 | """Fill the status info initially.""" |
252 | 137 | called = [] | 137 | called = [] |
253 | 138 | def fake(): | 138 | def fake(): |
254 | 139 | """Fake method.""" | 139 | """Fake method.""" |
255 | @@ -167,7 +167,7 @@ | |||
256 | 167 | return deferred | 167 | return deferred |
257 | 168 | 168 | ||
258 | 169 | def test_status_changed_affects_cuurent_status(self): | 169 | def test_status_changed_affects_cuurent_status(self): |
260 | 170 | """Makes changes to see how status are reflected.""" | 170 | """Make changes to see how status are reflected.""" |
261 | 171 | # one set of values | 171 | # one set of values |
262 | 172 | self.sd.on_sd_status_changed('name1', 'description1', False, True, | 172 | self.sd.on_sd_status_changed('name1', 'description1', False, True, |
263 | 173 | False, 'queues1', 'connection1') | 173 | False, 'queues1', 'connection1') |
264 | @@ -261,7 +261,7 @@ | |||
265 | 261 | 261 | ||
266 | 262 | @defer.inlineCallbacks | 262 | @defer.inlineCallbacks |
267 | 263 | def test_initial_value(self): | 263 | def test_initial_value(self): |
269 | 264 | """Fills the content queue info initially.""" | 264 | """Fill the content queue info initially.""" |
270 | 265 | called = [] | 265 | called = [] |
271 | 266 | self.sd.dbus.get_content_queue = lambda: called.append(True) | 266 | self.sd.dbus.get_content_queue = lambda: called.append(True) |
272 | 267 | yield self.sd._get_initial_data() | 267 | yield self.sd._get_initial_data() |
273 | @@ -341,7 +341,7 @@ | |||
274 | 341 | 341 | ||
275 | 342 | @defer.inlineCallbacks | 342 | @defer.inlineCallbacks |
276 | 343 | def test_initial_value(self): | 343 | def test_initial_value(self): |
278 | 344 | """Fills the meta queue info initially.""" | 344 | """Fill the meta queue info initially.""" |
279 | 345 | called = [] | 345 | called = [] |
280 | 346 | def f(): | 346 | def f(): |
281 | 347 | """Helper function.""" | 347 | """Helper function.""" |
282 | @@ -777,11 +777,38 @@ | |||
283 | 777 | self.assertTrue(self.hdlr.check_inf("SD Name Owner changed: True")) | 777 | self.assertTrue(self.hdlr.check_inf("SD Name Owner changed: True")) |
284 | 778 | 778 | ||
285 | 779 | 779 | ||
286 | 780 | class MetadataTests(BaseTest): | ||
287 | 781 | """Get Metadata info.""" | ||
288 | 782 | |||
289 | 783 | def test_get_metadata_no_callback_set(self): | ||
290 | 784 | """It's mandatory to set the callback for this response.""" | ||
291 | 785 | self.assertRaises(ValueError, self.sd.get_metadata, 'path') | ||
292 | 786 | |||
293 | 787 | def test_get_metadata_ok(self): | ||
294 | 788 | """Get the metadata for given path.""" | ||
295 | 789 | called = [] | ||
296 | 790 | self.sd.dbus.get_metadata = lambda p: defer.succeed('foo') | ||
297 | 791 | self.sd.on_metadata_ready_callback = lambda *a: called.extend(a) | ||
298 | 792 | self.sd.get_metadata('path') | ||
299 | 793 | self.assertEqual(called, ['path', 'foo']) | ||
300 | 794 | |||
301 | 795 | def test_get_metadata_double(self): | ||
302 | 796 | """Get the metadata twice.""" | ||
303 | 797 | called = [] | ||
304 | 798 | fake_md = {'path1': 'foo', 'path2': 'bar'} | ||
305 | 799 | self.sd.dbus.get_metadata = lambda p: defer.succeed(fake_md[p]) | ||
306 | 800 | self.sd.on_metadata_ready_callback = lambda *a: called.append(a) | ||
307 | 801 | self.sd.get_metadata('path1') | ||
308 | 802 | self.sd.get_metadata('path2') | ||
309 | 803 | self.assertEqual(called[0], ('path1', 'foo')) | ||
310 | 804 | self.assertEqual(called[1], ('path2', 'bar')) | ||
311 | 805 | |||
312 | 806 | |||
313 | 780 | class FoldersTests(BaseTest): | 807 | class FoldersTests(BaseTest): |
314 | 781 | """Folders checking.""" | 808 | """Folders checking.""" |
315 | 782 | 809 | ||
316 | 783 | def test_foldercreated_callback(self): | 810 | def test_foldercreated_callback(self): |
318 | 784 | """Gets the new data after the folders changed.""" | 811 | """Get the new data after the folders changed.""" |
319 | 785 | # set the callback | 812 | # set the callback |
320 | 786 | called = [] | 813 | called = [] |
321 | 787 | self.sd.dbus.get_folders = lambda: called.append(True) | 814 | self.sd.dbus.get_folders = lambda: called.append(True) |
322 | @@ -794,7 +821,7 @@ | |||
323 | 794 | 821 | ||
324 | 795 | @defer.inlineCallbacks | 822 | @defer.inlineCallbacks |
325 | 796 | def test_initial_value(self): | 823 | def test_initial_value(self): |
327 | 797 | """Fills the folder info initially.""" | 824 | """Fill the folder info initially.""" |
328 | 798 | called = [] | 825 | called = [] |
329 | 799 | self.sd.dbus.get_folders = lambda: called.append(True) | 826 | self.sd.dbus.get_folders = lambda: called.append(True) |
330 | 800 | yield self.sd._get_initial_data() | 827 | yield self.sd._get_initial_data() |
331 | @@ -817,7 +844,7 @@ | |||
332 | 817 | """Shares checking.""" | 844 | """Shares checking.""" |
333 | 818 | 845 | ||
334 | 819 | def test_shares_changed_callback(self): | 846 | def test_shares_changed_callback(self): |
336 | 820 | """Gets the new data after the shares changed.""" | 847 | """Get the new data after the shares changed.""" |
337 | 821 | # set the callback | 848 | # set the callback |
338 | 822 | called = [] | 849 | called = [] |
339 | 823 | self.sd.dbus.get_shares_to_me = lambda: called.append(True) | 850 | self.sd.dbus.get_shares_to_me = lambda: called.append(True) |
340 | @@ -831,7 +858,7 @@ | |||
341 | 831 | 858 | ||
342 | 832 | @defer.inlineCallbacks | 859 | @defer.inlineCallbacks |
343 | 833 | def test_initial_value(self): | 860 | def test_initial_value(self): |
345 | 834 | """Fills the folder info initially.""" | 861 | """Fill the folder info initially.""" |
346 | 835 | called = [] | 862 | called = [] |
347 | 836 | self.sd.dbus.get_shares_to_me = lambda: called.append(True) | 863 | self.sd.dbus.get_shares_to_me = lambda: called.append(True) |
348 | 837 | self.sd.dbus.get_shares_to_others = lambda: called.append(True) | 864 | self.sd.dbus.get_shares_to_others = lambda: called.append(True) |
Docstring """Processes...""" needs fixing to """Process""". Same for "Gets" and "Returns".