Merge lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.3 into lp:ubuntuone-control-panel/stable-3-0

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 247
Merged at revision: 246
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.3
Merge into: lp:ubuntuone-control-panel/stable-3-0
Diff against target: 518 lines (+131/-77)
17 files modified
run-tests.bat (+40/-35)
setup.py (+2/-1)
ubuntuone/controlpanel/backend.py (+16/-6)
ubuntuone/controlpanel/dbus_service.py (+5/-10)
ubuntuone/controlpanel/gui/gtk/gui.py (+2/-0)
ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py (+4/-0)
ubuntuone/controlpanel/gui/gtk/widgets.py (+3/-0)
ubuntuone/controlpanel/gui/qt/addfolder.py (+3/-5)
ubuntuone/controlpanel/gui/qt/main/__init__.py (+4/-0)
ubuntuone/controlpanel/gui/qt/main/linux.py (+0/-5)
ubuntuone/controlpanel/gui/qt/main/windows.py (+1/-7)
ubuntuone/controlpanel/gui/qt/tests/__init__.py (+4/-0)
ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py (+2/-1)
ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py (+2/-2)
ubuntuone/controlpanel/sd_client/__init__.py (+4/-0)
ubuntuone/controlpanel/tests/test_backend.py (+28/-2)
ubuntuone/controlpanel/tests/test_sd_client.py (+11/-3)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.3
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+90964@code.launchpad.net

Commit message

[ Roberto Alsina <email address hidden>
  - Use uncompressed resources and the same qss loading code in both platforms
  to avoid future inconsistencies (LP: #917322).

[ Diego Sarmentero <email address hidden> ]
  - Folder list no longer shows garbage for user homes non-ascii
    (LP: #851356).

[ Natalia B. Bidart <email address hidden> ]
  - Fix lint issues (LP: #920640).

[ Manuel de la Pena <email address hidden> ]
  - Adds the possibility to skip the lint checks on windows when passing the
  /skip-lint parameter to run-tests.bat (LP: #918248).

To post a comment you must log in.
247. By Natalia Bidart

Attaching bug numbers.

Revision history for this message
Roberto Alsina (ralsina) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-tests.bat'
2--- run-tests.bat 2011-12-27 18:48:44 +0000
3+++ run-tests.bat 2012-01-31 21:52:23 +0000
4@@ -1,37 +1,42 @@
5-:: Author: Natalia B. Bidart <natalia.bidart@canonical.com>
6-::
7-:: Copyright 2011 Canonical Ltd.
8-::
9-:: This program is free software: you can redistribute it and/or modify it
10-:: under the terms of the GNU General Public License version 3, as published
11-:: by the Free Software Foundation.
12-::
13-:: This program is distributed in the hope that it will be useful, but
14-:: WITHOUT ANY WARRANTY; without even the implied warranties of
15-:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
16-:: PURPOSE. See the GNU General Public License for more details.
17-::
18-:: You should have received a copy of the GNU General Public License along
19-:: with this program. If not, see <http://www.gnu.org/licenses/>.
20-
21-:: call setup.py build so that the qt uic is called
22-
23-@ECHO off
24-
25-SET MODULE="ubuntuone"
26-SET PYTHONEXEPATH="C:\Python27"
27-SET IGNORE_PATHS="ubuntuone\controlpanel\gui\gtk, ubuntuone\controlpanel\dbustests"
28+:: Copyright 2011-12 Canonical Ltd.
29+::
30+:: This program is free software: you can redistribute it and/or modify it
31+:: under the terms of the GNU General Public License version 3, as published
32+:: by the Free Software Foundation.
33+::
34+:: This program is distributed in the hope that it will be useful, but
35+:: WITHOUT ANY WARRANTY; without even the implied warranties of
36+:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
37+:: PURPOSE. See the GNU General Public License for more details.
38+::
39+:: You should have received a copy of the GNU General Public License along
40+:: with this program. If not, see <http://www.gnu.org/licenses/>.
41+
42+:: call setup.py build so that the qt uic is called
43+
44+@ECHO off
45+
46+SET MODULE="ubuntuone"
47+SET PYTHONEXEPATH="C:\Python27"
48+SET IGNORE_PATHS="ubuntuone\controlpanel\gui\gtk, ubuntuone\controlpanel\dbustests"
49 SET IGNORE_MODULES="test_linux.py, test_libsoup.py"
50
51-"%PYTHONEXEPATH%\python.exe" setup.py build
52-ECHO Running tests
53-:: execute the tests with a number of ignored linux only modules
54-"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=qt4 --gui -p %IGNORE_PATHS% -i %IGNORE_MODULES% %MODULE%
55-:: Clean the build from the setupt.py
56-ECHO Cleaning the generated code before running the style checks...
57-"%PYTHONEXEPATH%\python.exe" setup.py clean
58-ECHO Performing style checks...
59-"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" --ignore ubuntuone\controlpanel\gui\qt\ui "%MODULE%"
60-"%PYTHONEXEPATH%\Scripts\pep8.exe" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py" --repeat . bin\*
61-:: Delete the temp folders
62-RMDIR /s /q _trial_temp
63+SET SKIPLINT=0
64+:: lets check if we pass the /skip-lint param, if we did we remember and use shift
65+if "%1" == "/skip-lint" SET SKIPLINT=1
66+
67+"%PYTHONEXEPATH%\python.exe" setup.py build
68+ECHO Running tests
69+:: execute the tests with a number of ignored linux only modules
70+"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=qt4 --gui -p %IGNORE_PATHS% -i %IGNORE_MODULES% %MODULE%
71+:: Clean the build from the setupt.py
72+ECHO Cleaning the generated code
73+"%PYTHONEXEPATH%\python.exe" setup.py clean
74+
75+IF %SKIPLINT% == 1 GOTO :CLEAN
76+ECHO Performing style checks...
77+"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" --ignore ubuntuone\controlpanel\gui\qt\ui "%MODULE%"
78+"%PYTHONEXEPATH%\Scripts\pep8.exe" --exclude ".svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py" --repeat . bin\*
79+:CLEAN
80+:: Delete the temp folders
81+RMDIR /s /q _trial_temp
82
83=== modified file 'setup.py'
84--- setup.py 2012-01-03 18:06:05 +0000
85+++ setup.py 2012-01-31 21:52:23 +0000
86@@ -116,7 +116,8 @@
87 path = os.getenv('PATH')
88 os.putenv('PATH', path + os.path.pathsep + os.path.join(
89 os.path.dirname(PyQt4.__file__), 'bin'))
90- if os.system('pyrcc4 "%s" -o "%s"' % (qrc_file, py_file)) > 0:
91+ if os.system('pyrcc4 -no-compress "%s" -o "%s"' %
92+ (qrc_file, py_file)) > 0:
93 self.warn('Unable to generate python module {py_file}'
94 ' for resource file {qrc_file}'.format(
95 py_file=py_file, qrc_file=qrc_file))
96
97=== modified file 'ubuntuone/controlpanel/backend.py'
98--- ubuntuone/controlpanel/backend.py 2011-09-16 16:38:43 +0000
99+++ ubuntuone/controlpanel/backend.py 2012-01-31 21:52:23 +0000
100@@ -139,6 +139,10 @@
101
102 logger.info('ControlBackend: instance started.')
103
104+ def get_home_dir(self):
105+ """Return a defer with the home_dir from ubuntu one client."""
106+ return self.sd_client.get_home_dir()
107+
108 def _process_file_sync_status(self, status):
109 """Process raw file sync status into custom format.
110
111@@ -289,11 +293,15 @@
112
113 returnValue(local_device)
114
115+ @inlineCallbacks
116 def _process_path(self, path):
117 """Trim 'path' so the '~' is removed."""
118- home = os.path.expanduser('~')
119- result = path.replace(os.path.join(home, ''), '')
120- return result
121+ home_dir = yield self.get_home_dir()
122+ if not home_dir.endswith(os.path.sep):
123+ home_dir += os.path.sep
124+ if path.startswith(home_dir):
125+ path = path[len(home_dir):]
126+ returnValue(path)
127
128 @inlineCallbacks
129 def get_credentials(self):
130@@ -578,9 +586,10 @@
131 folders = yield self.sd_client.get_folders()
132 shares = yield self.sd_client.get_shares()
133
134+ display_name = yield self._process_path(root_dir)
135 root_volume = {u'volume_id': u'', u'path': root_dir,
136 u'subscribed': True, u'type': self.ROOT_TYPE,
137- u'display_name': self._process_path(root_dir)}
138+ u'display_name': display_name}
139 self._volumes[u''] = root_volume
140
141 # group shares by the offering user
142@@ -618,7 +627,8 @@
143 logger.warning('volumes_info: udf %r already in the volumes '
144 'list (%r).', vid, self._volumes[vid])
145 folder[u'subscribed'] = bool(folder[u'subscribed'])
146- folder[u'display_name'] = self._process_path(folder[u'path'])
147+ display_name = yield self._process_path(folder[u'path'])
148+ folder[u'display_name'] = display_name
149 self._volumes[vid] = folder
150
151 folders.sort(key=operator.itemgetter('path'))
152@@ -678,7 +688,7 @@
153 @inlineCallbacks
154 def validate_path_for_folder(self, folder_path):
155 """Validate 'folder_path' for folder creation."""
156- user_home = os.path.expanduser('~')
157+ user_home = yield self.get_home_dir()
158 folder_path = append_path_sep(folder_path)
159
160 # handle folder_path not within '~' or links
161
162=== modified file 'ubuntuone/controlpanel/dbus_service.py'
163--- ubuntuone/controlpanel/dbus_service.py 2011-09-14 19:08:52 +0000
164+++ ubuntuone/controlpanel/dbus_service.py 2012-01-31 21:52:23 +0000
165@@ -1,9 +1,6 @@
166 # -*- coding: utf-8 -*-
167-
168-# Authors: Alejandro J. Cura <alecu@canonical.com>
169-# Authors: Natalia B. Bidart <nataliabidart@canonical.com>
170 #
171-# Copyright 2010 Canonical Ltd.
172+# Copyright 2010-2012 Canonical Ltd.
173 #
174 # This program is free software: you can redistribute it and/or modify it
175 # under the terms of the GNU General Public License version 3, as published
176@@ -23,14 +20,12 @@
177 import sys
178
179 import dbus.service
180-# pylint: disable=E0611
181-# pylint: disable=W0404
182+# pylint: disable=E0611,W0404
183 if 'gobject' in sys.modules:
184 import gobject as GObject
185 else:
186 from gi.repository import GObject
187-# pylint: enable=W0404
188-# pylint: enable=E0611
189+# pylint: enable=E0611,W0404
190
191 from dbus.mainloop.glib import DBusGMainLoop
192 from dbus.service import method, signal
193@@ -156,6 +151,8 @@
194 class ControlPanelBackend(dbus.service.Object):
195 """Export the Control Panel backend thru DBus."""
196
197+ # pylint: disable=C0103,E1002
198+
199 def __init__(self, backend, *args, **kwargs):
200 """Create this instance of the backend."""
201 super(ControlPanelBackend, self).__init__(*args, **kwargs)
202@@ -164,8 +161,6 @@
203 logger.debug('ControlPanelBackend: created with %r, %r.',
204 args, kwargs)
205
206- # pylint: disable=C0103
207-
208 @log_call(logger.error)
209 @signal(dbus_interface=DBUS_PREFERENCES_IFACE, signature="a{ss}")
210 def UnauthorizedError(self, error):
211
212=== modified file 'ubuntuone/controlpanel/gui/gtk/gui.py'
213--- ubuntuone/controlpanel/gui/gtk/gui.py 2011-09-19 18:13:28 +0000
214+++ ubuntuone/controlpanel/gui/gtk/gui.py 2012-01-31 21:52:23 +0000
215@@ -840,6 +840,8 @@
216 else:
217 self.on_success()
218
219+ # Class 'style' has no 'bg' member
220+ # pylint: disable=E1101
221 odd_row_color = self.message.style.bg[gtk.STATE_NORMAL]
222 for i, device_info in enumerate(info):
223 device = Device(confirm_remove_dialog=self.confirm_remove_dialog)
224
225=== modified file 'ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py'
226--- ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py 2011-10-24 21:48:27 +0000
227+++ ubuntuone/controlpanel/gui/gtk/tests/test_widgets.py 2012-01-31 21:52:23 +0000
228@@ -24,6 +24,10 @@
229 from ubuntuone.controlpanel.gui.gtk import widgets
230
231
232+# Class 'style' has no 'fg' member
233+# pylint: disable=E1101
234+
235+
236 class LoadingTestCase(TestCase):
237 """Test suite for the Loading widget (a spinner plus a label)."""
238
239
240=== modified file 'ubuntuone/controlpanel/gui/gtk/widgets.py'
241--- ubuntuone/controlpanel/gui/gtk/widgets.py 2011-04-11 17:30:04 +0000
242+++ ubuntuone/controlpanel/gui/gtk/widgets.py 2012-01-31 21:52:23 +0000
243@@ -130,6 +130,9 @@
244 # Invalid name, Missing docstring, do not list fix-mes
245 # pylint: disable=C0103,C0111,W0511
246
247+ # Class 'style' has no 'attach', 'set_background', 'paint_flat_box' member
248+ # pylint: disable=E1101
249+
250 __gsignals__ = {
251 "damage_event": "override",
252 }
253
254=== modified file 'ubuntuone/controlpanel/gui/qt/addfolder.py'
255--- ubuntuone/controlpanel/gui/qt/addfolder.py 2011-12-26 19:45:13 +0000
256+++ ubuntuone/controlpanel/gui/qt/addfolder.py 2012-01-31 21:52:23 +0000
257@@ -20,8 +20,6 @@
258
259 from __future__ import division
260
261-import os
262-
263 from PyQt4 import QtGui, QtCore
264 from twisted.internet import defer
265
266@@ -56,8 +54,9 @@
267 def on_clicked(self):
268 """The 'Sync another folder' button was clicked."""
269 # The options argument is because of LP: #835013
270+ home_dir = yield self.backend.get_home_dir()
271 folder = QtGui.QFileDialog.getExistingDirectory(
272- parent=self, directory=os.path.expanduser('~'),
273+ parent=self, directory=home_dir,
274 options=QtGui.QFileDialog.DontUseNativeDialog)
275 folder = unicode(QtCore.QDir.toNativeSeparators(folder))
276 logger.debug('on_add_folder_button_clicked: user requested folder '
277@@ -68,9 +67,8 @@
278
279 is_valid = yield self.backend.validate_path_for_folder(folder)
280 if not is_valid:
281- user_home = os.path.expanduser('~')
282 text = FOLDER_INVALID_PATH % {'folder_path': folder,
283- 'home_folder': user_home}
284+ 'home_folder': home_dir}
285 QtGui.QMessageBox.warning(self, '', text, CLOSE)
286 return
287
288
289=== modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py'
290--- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-04 11:43:14 +0000
291+++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-01-31 21:52:23 +0000
292@@ -18,6 +18,8 @@
293
294 import sys
295
296+from PyQt4 import QtCore
297+
298 # Module used to include the resources into this file
299 # Unused import images_rc, pylint: disable=W0611
300 from ubuntuone.controlpanel.gui.qt.ui import images_rc
301@@ -42,6 +44,8 @@
302 # The main loop MUST be initialized before importing the reactor
303 app = UniqueApplication(sys.argv, "ubuntuone-control-panel")
304 source.main(app)
305+ qss = QtCore.QResource(":/ubuntuone.qss")
306+ app.setStyleSheet(qss.data())
307
308 # Reimport 'qt4reactor', 'reactor', 'start', pylint: disable=W0404, F0401
309 import qt4reactor
310
311=== modified file 'ubuntuone/controlpanel/gui/qt/main/linux.py'
312--- ubuntuone/controlpanel/gui/qt/main/linux.py 2011-11-11 19:27:07 +0000
313+++ ubuntuone/controlpanel/gui/qt/main/linux.py 2012-01-31 21:52:23 +0000
314@@ -17,14 +17,9 @@
315 """Main method to be used on linux."""
316
317 from dbus.mainloop.qt import DBusQtMainLoop
318-from PyQt4 import QtCore
319
320
321 def main(app):
322 """Apply style sheet."""
323 # The DBus main loop MUST be initialized before importing the reactor
324 DBusQtMainLoop(set_as_default=True)
325-
326- # Apply Style Sheet -- The linux version may be different
327- qss = QtCore.QResource(":/ubuntuone.qss")
328- app.setStyleSheet(qss.data())
329
330=== modified file 'ubuntuone/controlpanel/gui/qt/main/windows.py'
331--- ubuntuone/controlpanel/gui/qt/main/windows.py 2011-11-11 19:40:10 +0000
332+++ ubuntuone/controlpanel/gui/qt/main/windows.py 2012-01-31 21:52:23 +0000
333@@ -16,7 +16,7 @@
334
335 """Main method to be used on windows."""
336
337-from PyQt4 import QtGui, QtCore
338+from PyQt4 import QtGui
339
340
341 def main(app):
342@@ -24,9 +24,3 @@
343 # Apply font to the entire application
344 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf')
345 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf')
346-
347- # Apply Style Sheet -- The windows version may be different
348- qss_file = QtCore.QFile(":/ubuntuone.qss")
349- qss_file.open(QtCore.QFile.ReadOnly)
350- stylesheet = QtCore.QLatin1String(qss_file.readAll())
351- app.setStyleSheet(stylesheet)
352
353=== modified file 'ubuntuone/controlpanel/gui/qt/tests/__init__.py'
354--- ubuntuone/controlpanel/gui/qt/tests/__init__.py 2011-10-24 21:48:27 +0000
355+++ ubuntuone/controlpanel/gui/qt/tests/__init__.py 2012-01-31 21:52:23 +0000
356@@ -127,6 +127,10 @@
357 self._called['get_credentials'] = ((), {})
358 return TOKEN
359
360+ def get_home_dir(self):
361+ """Fake home return."""
362+ return USER_HOME
363+
364
365 class CrashyBackendException(Exception):
366 """A faked backend crash."""
367
368=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py'
369--- ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2011-12-26 19:45:13 +0000
370+++ ubuntuone/controlpanel/gui/qt/tests/test_addfolder.py 2012-01-31 21:52:23 +0000
371@@ -80,10 +80,11 @@
372 """When adding a new folder, the proper file chooser is raised."""
373 yield self.ui.click()
374
375+ home_dir = yield self.ui.backend.get_home_dir()
376 self.assertEqual(FakedFileDialog.args, ())
377 self.assertEqual(FakedFileDialog.kwargs, {
378 'options': gui.QtGui.QFileDialog.DontUseNativeDialog,
379- 'directory': os.path.expanduser('~'),
380+ 'directory': home_dir,
381 'parent': self.ui,
382 })
383
384
385=== modified file 'ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py'
386--- ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py 2012-01-02 14:29:16 +0000
387+++ ubuntuone/controlpanel/gui/qt/uniqueapp/__init__.py 2012-01-31 21:52:23 +0000
388@@ -20,9 +20,9 @@
389 import sys
390
391 if sys.platform == "win32":
392- import windows as platform
393+ from ubuntuone.controlpanel.gui.qt.uniqueapp import windows as platform
394 else:
395- import linux as platform
396+ from ubuntuone.controlpanel.gui.qt.uniqueapp import linux as platform
397
398 #pylint: disable=C0103
399 UniqueApplication = platform.UniqueApplication
400
401=== modified file 'ubuntuone/controlpanel/sd_client/__init__.py'
402--- ubuntuone/controlpanel/sd_client/__init__.py 2011-08-24 19:56:19 +0000
403+++ ubuntuone/controlpanel/sd_client/__init__.py 2012-01-31 21:52:23 +0000
404@@ -108,6 +108,10 @@
405 """Disable udf_autosubscribe in the syncdaemon."""
406 return self.proxy.enable_udf_autosubscribe(False)
407
408+ def get_home_dir(self):
409+ """Retrieve the root information from syncdaemon."""
410+ return self.proxy.get_home_dir()
411+
412 def get_root_dir(self):
413 """Retrieve the root information from syncdaemon."""
414 return self.proxy.get_root_dir()
415
416=== modified file 'ubuntuone/controlpanel/tests/test_backend.py'
417--- ubuntuone/controlpanel/tests/test_backend.py 2011-10-24 21:48:27 +0000
418+++ ubuntuone/controlpanel/tests/test_backend.py 2012-01-31 21:52:23 +0000
419@@ -248,6 +248,10 @@
420 """Stop the file_sync service."""
421 self.actions.append('stop')
422
423+ def get_home_dir(self):
424+ """Grab the home dir."""
425+ return USER_HOME
426+
427 def get_root_dir(self):
428 """Grab the root dir."""
429 return ROOT_PATH
430@@ -784,10 +788,11 @@
431 self.be.wc.results[QUOTA_API] = SAMPLE_QUOTA_JSON
432
433 # root dir info
434+ display_name = yield self.be._process_path(ROOT_PATH)
435 self.root_volume = {
436 u'volume_id': u'', u'path': ROOT_PATH, u'subscribed': True,
437 u'type': self.be.ROOT_TYPE,
438- u'display_name': self.be._process_path(ROOT_PATH),
439+ u'display_name': display_name,
440 }
441
442 @inlineCallbacks
443@@ -831,7 +836,8 @@
444 folder = folder.copy()
445 folder[u'type'] = self.be.FOLDER_TYPE
446 folder[u'subscribed'] = bool(folder[u'subscribed'])
447- folder[u'display_name'] = self.be._process_path(folder[u'path'])
448+ display_name = yield self.be._process_path(folder[u'path'])
449+ folder[u'display_name'] = display_name
450 folders.append(folder)
451
452 # sort folders by path
453@@ -863,6 +869,26 @@
454 self.assertEqual(result, expected)
455
456 @inlineCallbacks
457+ def test_volumes_info_process_path(self):
458+ """The volumes_info method exercises its callback."""
459+ root_path = USER_HOME + os.path.sep + 'My Ubuntu' + USER_HOME
460+ self.patch(self.be.sd_client, 'get_root_dir', lambda: root_path)
461+ for item in SAMPLE_FOLDERS:
462+ path = item[u'path']
463+ path = path[len(USER_HOME) + 1:]
464+ item[u'path'] = os.path.join(root_path, path)
465+ self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES)
466+ self.patch(self.be.sd_client, 'folders', SAMPLE_FOLDERS)
467+
468+ yield self.be.volumes_info()
469+ for item in SAMPLE_FOLDERS:
470+ key = item[u'volume_id']
471+ folder = self.be._volumes[key]
472+ display_name = folder['display_name']
473+ prefix = 'My Ubuntu' + USER_HOME
474+ self.assertTrue(display_name.startswith(prefix))
475+
476+ @inlineCallbacks
477 def test_volumes_info_without_storage_info(self):
478 """The volumes_info method exercises its callback."""
479 self.patch(self.be.sd_client, 'shares', SAMPLE_SHARES)
480
481=== modified file 'ubuntuone/controlpanel/tests/test_sd_client.py'
482--- ubuntuone/controlpanel/tests/test_sd_client.py 2011-11-21 13:32:44 +0000
483+++ ubuntuone/controlpanel/tests/test_sd_client.py 2012-01-31 21:52:23 +0000
484@@ -34,6 +34,9 @@
485 from ubuntuone.controlpanel import sd_client
486 from ubuntuone.controlpanel.tests import TestCase
487
488+# Instance of 'SyncDaemonTool' has no 'foo' member
489+# pylint: disable=E1101
490+
491
492 SAMPLE_LIMITS = {'upload': 999, 'download': 838}
493
494@@ -66,9 +69,10 @@
495 called = {}
496 shares = {}
497 folders = {}
498- root_dir = os.path.expanduser('~/Ubuntu One')
499- shares_dir = os.path.expanduser('~/.cache/ubuntuone/shares')
500- shares_dir_link = os.path.join(root_dir, 'Shared With Me')
501+ home_dir = u'/home/ñandu úser'
502+ root_dir = os.path.join(home_dir, u'Ubuntu One')
503+ shares_dir = os.path.join(home_dir, u'.cache/ubuntuone/shares')
504+ shares_dir_link = os.path.join(root_dir, u'Shared With Me')
505
506 @classmethod
507 def create_share(cls, name, accepted=False, subscribed=False):
508@@ -299,6 +303,10 @@
509 """Request a rescan from scratch for volume_id."""
510 self.called['rescan_from_scratch'] = volume_id
511
512+ def get_home_dir(self):
513+ """Return the root directory."""
514+ return self.home_dir
515+
516 def get_root_dir(self):
517 """Return the root directory."""
518 return self.root_dir

Subscribers

People subscribed via source and target branches