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

Proposed by dobey on 2012-06-14
Status: Merged
Approved by: dobey on 2012-06-14
Approved revision: 266
Merged at revision: 265
Proposed branch: lp:~dobey/ubuntuone-control-panel/update-3-0
Merge into: lp:ubuntuone-control-panel/stable-3-0
Diff against target: 149 lines (+33/-47)
2 files modified
ubuntuone/controlpanel/gui/qt/folders.py (+3/-0)
ubuntuone/controlpanel/gui/qt/tests/test_folders.py (+30/-47)
To merge this branch: bzr merge lp:~dobey/ubuntuone-control-panel/update-3-0
Reviewer Review Type Date Requested Status
Brian Curtin (community) Approve on 2012-06-14
Roberto Alsina (community) 2012-06-14 Approve on 2012-06-14
Review via email: mp+110378@code.launchpad.net

Commit message

- Enable folder list sorting (Fixes LP:1006385).

To post a comment you must log in.
Roberto Alsina (ralsina) :
review: Approve
review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~dobey/ubuntuone-control-panel/update-3-0 into lp:ubuntuone-control-panel/stable-3-0 failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***

ERROR:root:Could not find any typelib for Unity
Traceback (most recent call last):
  File "/usr/bin/u1trial", line 337, in <module>
    main()
  File "/usr/bin/u1trial", line 317, in main
    suite = trial_runner.get_suite(config)
  File "/usr/bin/u1trial", line 196, in get_suite
    config['ignore-paths']))
  File "/usr/bin/u1trial", line 180, in _collect_tests
    module_suite = self._load_unittest(filepath)
  File "/usr/bin/u1trial", line 120, in _load_unittest
    module = __import__(modpath, None, None, [""])
  File "/mnt/tarmac/cache/ubuntuone-control-panel/stable-3-0/ubuntuone/controlpanel/tests/test_web_client.py", line 24, in <module>
    from ubuntu_sso.utils.webclient.tests import BaseMockWebServer
ImportError: No module named tests

Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (384.4 KiB)

The attempt to merge lp:~dobey/ubuntuone-control-panel/update-3-0 into lp:ubuntuone-control-panel/stable-3-0 failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***
ubuntuone.controlpanel.utils.tests.test_utils
  ExceptionHandlingTestCase
    test_exception_to_error_dict ... [OK]
    test_failure_to_error_dict ... [OK]
  GetDataFileTestCase
    test_get_data_file ... [OK]
  GetProjectDirTestCase
    test_get_project_dir_none_exists ... [OK]
    test_get_project_dir_relative ... [OK]
  GetProjectDirWithConstantsTestCase
    test_get_project_dir ... [OK]
    test_get_project_dir_none_exists ... [OK]
    test_get_project_dir_relative ... [OK]
ubuntuone.controlpanel.tests
  TestCase
    runTest ... [OK]
ubuntuone.controlpanel.utils.tests.test_linux
  AutoupdaterTestCase
    test_are_updates_present ... [OK]
    test_perform_update ... [OK]
  DefaultFoldersTestCase
    test_default_folders_bad_encoding ... [OK]
    test_default_folders_empty_file ... [OK]
    test_default_folders_non_ascii ... [OK]
    test_default_folders_not_file ... [OK]
    test_default_folders_only_comments ... [OK]
    test_default_folders_parsed ... [OK]
    test_default_folders_syntax_error ... [OK]
ubuntuone.controlpanel.tests
  TestCase
    runTest ... [OK]
    runTest ... [OK]
ubuntuone.controlpanel.tests.test_web_client
  WebClientBuildSignedIriTestCase
    test_correct_app_name ... [OK]
    test_correct_query ... [OK]
    test_get_url ... [OK]
    test_get_url_error ... [OK]
    test_is_correct_domain ... [OK]
    test_is_correct_path ... [OK]
    test_is_correct_scheme ... [OK]
    test_unauthorized ... [OK]
    test_url_with_query ... [OK]
    test_uses_timestamper ... [OK]
  WebClientTestCase
    test_correct_app_name ... [OK]
    test_get_url ... [...

266. By dobey on 2012-06-14

Fix lint issue

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/folders.py'
2--- ubuntuone/controlpanel/gui/qt/folders.py 2012-05-18 16:52:11 +0000
3+++ ubuntuone/controlpanel/gui/qt/folders.py 2012-06-14 18:54:18 +0000
4@@ -132,6 +132,9 @@
5 headers.setResizeMode(SUBSCRIPTION_COL, headers.ResizeToContents)
6 headers.setResizeMode(EXPLORE_COL, headers.ResizeToContents)
7
8+ self.ui.folders.setSortingEnabled(True)
9+ self.ui.folders.sortByColumn(FOLDER_NAME_COL, QtCore.Qt.AscendingOrder)
10+
11 self.ui.share_publish_button.setText(FOLDERS_MANAGE_LABEL)
12 self.ui.share_publish_button.uri = MANAGE_FILES_LINK
13 QtGui.QApplication.instance().focusChanged.connect(self.focus_changed)
14
15=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py'
16--- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-05-18 16:52:11 +0000
17+++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-06-14 18:54:18 +0000
18@@ -18,13 +18,12 @@
19
20 import copy
21 import logging
22-import operator
23 import os
24 import Queue
25 import shutil
26 import sys
27
28-from PyQt4 import QtGui
29+from PyQt4 import QtCore, QtGui
30 from twisted.internet import defer
31 from ubuntuone.devtools.handlers import MementoHandler
32 from ubuntuone.devtools.testcases import skipIfOS
33@@ -193,28 +192,21 @@
34
35 def test_process_info(self):
36 """The volumes info is processed when ready."""
37+ folders = self.ui.ui.folders
38 self.ui.process_info(FAKE_VOLUMES_INFO)
39- folders = self.ui.ui.folders
40-
41 root = folders.invisibleRootItem()
42 self.assertEqual(len(FAKE_VOLUMES_INFO), root.childCount())
43
44- treeiter = gui.QtGui.QTreeWidgetItemIterator(folders)
45 for name, _, volumes in FAKE_VOLUMES_INFO:
46 name = _build_name(name)
47-
48- # get first child, matching "My Folders"
49- item = treeiter.value()
50- self.assertFalse(item.is_empty)
51-
52+ items = folders.findItems(name, QtCore.Qt.MatchFixedString
53+ | QtCore.Qt.MatchCaseSensitive | QtCore.Qt.MatchRecursive,
54+ gui.FOLDER_NAME_COL)
55+ self.assertEqual(1, len(items))
56+ item = items[0]
57 self.assert_folder_group_header_correct(item, name)
58-
59 self.assertEqual(len(volumes), item.childCount())
60- sorted_vols = sorted(volumes, key=operator.itemgetter('path'))
61- for volume in sorted_vols:
62- treeiter += 1
63- item = treeiter.value() # get child folder
64- self.assertTrue(item is not None)
65+ for volume in volumes:
66
67 name = volume['path'].replace(USER_HOME + os.path.sep, '')
68 expected_path = volume['path']
69@@ -227,12 +219,14 @@
70 else:
71 icon_name = gui.SHARE_ICON_NAME
72
73+ items = folders.findItems(name, QtCore.Qt.MatchFixedString |
74+ QtCore.Qt.MatchCaseSensitive | QtCore.Qt.MatchRecursive,
75+ gui.FOLDER_NAME_COL)
76+ self.assertEqual(1, len(items))
77+ item = items[0]
78 self.assert_folder_row_correct(item, name, icon_name, volume,
79 tweaked_path=expected_path)
80
81- treeiter += 1
82- item = treeiter.value()
83-
84 def test_process_info_clears_the_list(self):
85 """The old volumes info is cleared before updated."""
86 self.ui.process_info(FAKE_VOLUMES_INFO)
87@@ -254,9 +248,10 @@
88
89 child_index = 0
90 root = self.ui.ui.folders.invisibleRootItem()
91- for name, _, _ in FAKE_VOLUMES_NO_FREE_SPACE_INFO:
92- name = _build_name(name)
93-
94+ names = [_build_name(name) for name, _, _ in
95+ FAKE_VOLUMES_NO_FREE_SPACE_INFO]
96+ names.sort(key=lambda x: x.lower())
97+ for name in names:
98 item = root.child(child_index)
99 self.assertFalse(item.is_empty)
100 self.assert_folder_group_header_correct(item, name)
101@@ -363,35 +358,23 @@
102 """Ensure that the inner widgets are in the correct tab order."""
103 self.ui.process_info(FAKE_VOLUMES_INFO)
104 folders = self.ui.ui.folders
105-
106 widget = self.ui.ui.folders.nextInFocusChain()
107 treeiter = gui.QtGui.QTreeWidgetItemIterator(folders)
108- for name, _, volumes in FAKE_VOLUMES_INFO:
109- item = treeiter.value()
110- sorted_vols = sorted(volumes, key=operator.itemgetter('path'))
111- for volume in sorted_vols:
112+ while treeiter.value():
113+ if treeiter.value().parent() is None: # Top-levels
114 treeiter += 1
115- item = treeiter.value() # get child folder
116-
117- name = volume['path'].replace(USER_HOME + os.path.sep, '')
118- if volume['type'] == self.ui.backend.SHARE_TYPE:
119- name = volume['name']
120- self.assertEqual(unicode(item.text(gui.FOLDER_NAME_COL)), name)
121-
122- if volume['type'] != self.ui.backend.ROOT_TYPE:
123- self.assertIsInstance(widget, QtGui.QCheckBox)
124- self.assertEqual(unicode(
125- self.ui.widget_items[widget].text(0)), name)
126- widget = widget.nextInFocusChain()
127-
128- if not self.ui.remote_folders:
129- self.assertIsInstance(widget, QtGui.QPushButton)
130- self.assertEqual(unicode(
131- self.ui.widget_items[widget].text(0)), name)
132- widget = widget.nextInFocusChain()
133-
134+ continue
135+ if self.ui.remote_folders:
136+ self.assertIsInstance(widget, QtGui.QCheckBox)
137+ # ROOT volume has no checkbox
138+ elif treeiter.value().text(1) or self.ui.remote_folders:
139+ self.assertIsInstance(widget, QtGui.QPushButton)
140+ else:
141+ self.assertIsInstance(widget, QtGui.QCheckBox)
142+ widget = widget.nextInFocusChain()
143+ self.assertIsInstance(widget, QtGui.QPushButton)
144+ widget = widget.nextInFocusChain()
145 treeiter += 1
146- item = treeiter.value()
147
148 def test_widget_dict(self):
149 """Ensure the widget_items dictionary is full."""

Subscribers

People subscribed via source and target branches

to all changes: