Merge lp:~nataliabidart/ubuntuone-control-panel/letmeremove into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 189
Merged at revision: 188
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/letmeremove
Merge into: lp:ubuntuone-control-panel
Diff against target: 583 lines (+243/-131)
9 files modified
data/qt/device.ui (+8/-1)
data/qt/devices.ui (+69/-105)
ubuntuone/controlpanel/gui/qt/device.py (+36/-9)
ubuntuone/controlpanel/gui/qt/devices.py (+5/-1)
ubuntuone/controlpanel/gui/qt/loadingoverlay.py (+2/-1)
ubuntuone/controlpanel/gui/qt/tests/__init__.py (+3/-0)
ubuntuone/controlpanel/gui/qt/tests/test_device.py (+89/-4)
ubuntuone/controlpanel/gui/qt/tests/test_devices.py (+14/-2)
ubuntuone/controlpanel/gui/tests/__init__.py (+17/-8)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/letmeremove
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+68444@code.launchpad.net

Commit message

- Local device can now be removed (LP: #810662).

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

Added code to remove local device once removed.

189. By Natalia Bidart

Merged trunk in.

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

+1

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Clean code, tests pass, works irl. Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/qt/device.ui'
--- data/qt/device.ui 2011-07-11 11:19:09 +0000
+++ data/qt/device.ui 2011-07-19 19:17:30 +0000
@@ -24,7 +24,7 @@
24 <item>24 <item>
25 <widget class="QLabel" name="device_name_label">25 <widget class="QLabel" name="device_name_label">
26 <property name="text">26 <property name="text">
27 <string>Another device</string>27 <string>Local device</string>
28 </property>28 </property>
29 </widget>29 </widget>
30 </item>30 </item>
@@ -41,6 +41,13 @@
41 </property>41 </property>
42 </spacer>42 </spacer>
43 </item>43 </item>
44 <item>
45 <widget class="QPushButton" name="remove_device_button">
46 <property name="text">
47 <string>Delete device</string>
48 </property>
49 </widget>
50 </item>
44 </layout>51 </layout>
45 </widget>52 </widget>
46 <resources>53 <resources>
4754
=== modified file 'data/qt/devices.ui'
--- data/qt/devices.ui 2011-07-11 11:19:09 +0000
+++ data/qt/devices.ui 2011-07-19 19:17:30 +0000
@@ -6,8 +6,8 @@
6 <rect>6 <rect>
7 <x>0</x>7 <x>0</x>
8 <y>0</y>8 <y>0</y>
9 <width>688</width>9 <width>325</width>
10 <height>371</height>10 <height>252</height>
11 </rect>11 </rect>
12 </property>12 </property>
13 <property name="windowTitle">13 <property name="windowTitle">
@@ -21,111 +21,75 @@
21 <number>0</number>21 <number>0</number>
22 </property>22 </property>
23 <item>23 <item>
24 <widget class="QFrame" name="frame">24 <layout class="QVBoxLayout" name="local_device_box"/>
25 <property name="frameShape">25 </item>
26 <enum>QFrame::StyledPanel</enum>26 <item>
27 </property>27 <layout class="QHBoxLayout" name="horizontalLayout">
28 <property name="frameShadow">28 <item>
29 <enum>QFrame::Raised</enum>29 <widget class="QLabel" name="other_devices_label">
30 </property>30 <property name="text">
31 <layout class="QVBoxLayout" name="verticalLayout_2">31 <string>Other devices</string>
32 <item>32 </property>
33 <layout class="QHBoxLayout" name="horizontalLayout_2">33 </widget>
34 <item>34 </item>
35 <layout class="QVBoxLayout" name="local_device_box"/>35 <item>
36 </item>36 <spacer name="horizontalSpacer">
37 <item>37 <property name="orientation">
38 <spacer name="horizontalSpacer_2">38 <enum>Qt::Horizontal</enum>
39 <property name="orientation">39 </property>
40 <enum>Qt::Horizontal</enum>40 <property name="sizeHint" stdset="0">
41 </property>41 <size>
42 <property name="sizeHint" stdset="0">42 <width>40</width>
43 <size>43 <height>20</height>
44 <width>40</width>44 </size>
45 <height>20</height>45 </property>
46 </size>46 </spacer>
47 </property>47 </item>
48 </spacer>48 </layout>
49 </item>49 </item>
50 <item>50 <item>
51 <widget class="QPushButton" name="delete_device_button">51 <widget class="QListWidget" name="list_devices">
52 <property name="text">52 <property name="alternatingRowColors">
53 <string>Delete device</string>53 <bool>true</bool>
54 </property>54 </property>
55 </widget>55 <property name="iconSize">
56 </item>56 <size>
57 </layout>57 <width>32</width>
58 </item>58 <height>32</height>
59 <item>59 </size>
60 <layout class="QHBoxLayout" name="horizontalLayout">60 </property>
61 <item>61 <property name="spacing">
62 <widget class="QLabel" name="other_devices_label">62 <number>0</number>
63 <property name="text">63 </property>
64 <string>Other devices</string>64 <property name="selectionRectVisible">
65 </property>65 <bool>false</bool>
66 </widget>66 </property>
67 </item>
68 <item>
69 <spacer name="horizontalSpacer">
70 <property name="orientation">
71 <enum>Qt::Horizontal</enum>
72 </property>
73 <property name="sizeHint" stdset="0">
74 <size>
75 <width>40</width>
76 <height>20</height>
77 </size>
78 </property>
79 </spacer>
80 </item>
81 </layout>
82 </item>
83 <item>
84 <widget class="QListWidget" name="list_devices">
85 <property name="alternatingRowColors">
86 <bool>true</bool>
87 </property>
88 <property name="iconSize">
89 <size>
90 <width>32</width>
91 <height>32</height>
92 </size>
93 </property>
94 <property name="spacing">
95 <number>0</number>
96 </property>
97 <property name="selectionRectVisible">
98 <bool>false</bool>
99 </property>
100 </widget>
101 </item>
102 <item>
103 <layout class="QHBoxLayout" name="horizontalLayout_3">
104 <item>
105 <widget class="QPushButton" name="manage_devices_button">
106 <property name="sizePolicy">
107 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
108 <horstretch>0</horstretch>
109 <verstretch>0</verstretch>
110 </sizepolicy>
111 </property>
112 <property name="layoutDirection">
113 <enum>Qt::RightToLeft</enum>
114 </property>
115 <property name="text">
116 <string>Go to the web page to manage your other devices</string>
117 </property>
118 <property name="icon">
119 <iconset resource="images.qrc">
120 <normaloff>:/external_icon_white.png</normaloff>:/external_icon_white.png</iconset>
121 </property>
122 </widget>
123 </item>
124 </layout>
125 </item>
126 </layout>
127 </widget>67 </widget>
128 </item>68 </item>
69 <item>
70 <layout class="QHBoxLayout" name="horizontalLayout_3">
71 <item>
72 <widget class="QPushButton" name="manage_devices_button">
73 <property name="sizePolicy">
74 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
75 <horstretch>0</horstretch>
76 <verstretch>0</verstretch>
77 </sizepolicy>
78 </property>
79 <property name="layoutDirection">
80 <enum>Qt::RightToLeft</enum>
81 </property>
82 <property name="text">
83 <string>Go to the web page to manage your other devices</string>
84 </property>
85 <property name="icon">
86 <iconset resource="images.qrc">
87 <normaloff>:/external_icon_white.png</normaloff>:/external_icon_white.png</iconset>
88 </property>
89 </widget>
90 </item>
91 </layout>
92 </item>
129 </layout>93 </layout>
130 </widget>94 </widget>
131 <resources>95 <resources>
13296
=== modified file 'ubuntuone/controlpanel/gui/qt/device.py'
--- ubuntuone/controlpanel/gui/qt/device.py 2011-07-11 18:00:59 +0000
+++ ubuntuone/controlpanel/gui/qt/device.py 2011-07-19 19:17:30 +0000
@@ -18,22 +18,30 @@
1818
19"""The user interface for the control panel for Ubuntu One."""19"""The user interface for the control panel for Ubuntu One."""
2020
21from PyQt4 import QtGui21from PyQt4 import QtGui, QtCore
2222
23from twisted.internet import defer
24
25from ubuntuone.controlpanel.backend import (
26 DEVICE_TYPE_COMPUTER,
27 DEVICE_TYPE_PHONE,
28)
29from ubuntuone.controlpanel.gui import DEVICE_CONFIRM_REMOVE
23from ubuntuone.controlpanel.gui.qt.ui import device_ui30from ubuntuone.controlpanel.gui.qt.ui import device_ui
2431
25COMPUTER_ICON = "computer"32COMPUTER_ICON = "computer"
26PHONE_ICON = "phone"33PHONE_ICON = "phone"
27DEFAULT_ICON = COMPUTER_ICON34DEFAULT_ICON = COMPUTER_ICON
2835
29COMPUTER_TYPE = "Computer"
30PHONE_TYPE = "Phone"
31
32DEVICE_TYPE_TO_ICON_MAP = {36DEVICE_TYPE_TO_ICON_MAP = {
33 COMPUTER_TYPE: COMPUTER_ICON,37 DEVICE_TYPE_COMPUTER: COMPUTER_ICON,
34 PHONE_TYPE: PHONE_ICON,38 DEVICE_TYPE_PHONE: PHONE_ICON,
35}39}
3640
41CANCEL = QtGui.QMessageBox.Cancel
42NO = QtGui.QMessageBox.No
43YES = QtGui.QMessageBox.Yes
44
3745
38def icon_name_from_type(device_type):46def icon_name_from_type(device_type):
39 """Get the icon name for the device."""47 """Get the icon name for the device."""
@@ -44,11 +52,16 @@
44class DeviceWidget(QtGui.QWidget):52class DeviceWidget(QtGui.QWidget):
45 """The widget for each device in the control panel."""53 """The widget for each device in the control panel."""
4654
47 def __init__(self, *args):55 removed = QtCore.pyqtSignal()
56 removeCanceled = QtCore.pyqtSignal()
57
58 def __init__(self, backend, device_id, **kwargs):
48 """Initialize the UI of the widget."""59 """Initialize the UI of the widget."""
49 QtGui.QWidget.__init__(self, *args)60 QtGui.QWidget.__init__(self, **kwargs)
50 self.ui = device_ui.Ui_Form()61 self.ui = device_ui.Ui_Form()
51 self.ui.setupUi(self)62 self.ui.setupUi(self)
63 self.id = device_id
64 self.backend = backend
5265
53 def update_device_info(self, device_info):66 def update_device_info(self, device_info):
54 """Update the device info."""67 """Update the device info."""
@@ -57,6 +70,20 @@
57 pixmap = QtGui.QPixmap(pixmap_name)70 pixmap = QtGui.QPixmap(pixmap_name)
58 self.ui.device_icon_label.setPixmap(pixmap)71 self.ui.device_icon_label.setPixmap(pixmap)
5972
73 @defer.inlineCallbacks
74 @QtCore.pyqtSlot()
75 def on_remove_device_button_clicked(self):
76 """The user wants to remove this device."""
77 msg = DEVICE_CONFIRM_REMOVE
78 buttons = YES | NO
79 response = QtGui.QMessageBox.warning(self, '', msg, buttons, NO)
80
81 if response == YES:
82 yield self.backend.remove_device(device_id=self.id)
83 self.removed.emit()
84 else:
85 self.removeCanceled.emit()
86
6087
61def get_device_for_list_widget(device_info):88def get_device_for_list_widget(device_info):
62 """Return a QListWidgetItem representing a device with the proper info."""89 """Return a QListWidgetItem representing a device with the proper info."""
6390
=== modified file 'ubuntuone/controlpanel/gui/qt/devices.py'
--- ubuntuone/controlpanel/gui/qt/devices.py 2011-07-10 21:35:02 +0000
+++ ubuntuone/controlpanel/gui/qt/devices.py 2011-07-19 19:17:30 +0000
@@ -81,8 +81,12 @@
8181
82 def update_local_device(self, device_info):82 def update_local_device(self, device_info):
83 """Update the info for the local device."""83 """Update the info for the local device."""
84 device_widget = device.DeviceWidget()84 device_widget = device.DeviceWidget(backend=self.backend,
85 device_id=device_info['device_id'])
85 device_widget.update_device_info(device_info)86 device_widget.update_device_info(device_info)
87 f = lambda: self.clear_device_info(self.ui.local_device_box)
88 device_widget.removed.connect(f)
89
86 self.ui.local_device_box.addWidget(device_widget)90 self.ui.local_device_box.addWidget(device_widget)
8791
88 def create_remote_device(self, device_info):92 def create_remote_device(self, device_info):
8993
=== modified file 'ubuntuone/controlpanel/gui/qt/loadingoverlay.py'
--- ubuntuone/controlpanel/gui/qt/loadingoverlay.py 2011-07-12 18:47:13 +0000
+++ ubuntuone/controlpanel/gui/qt/loadingoverlay.py 2011-07-19 19:17:30 +0000
@@ -62,7 +62,8 @@
6262
63 def eventFilter(self, obj, event):63 def eventFilter(self, obj, event):
64 """Filter events from Frame content to draw the dot animation."""64 """Filter events from Frame content to draw the dot animation."""
65 if obj == self.ui.frm_box and event.type() == QtCore.QEvent.Paint:65 if getattr(self, 'ui', None) is not None and \
66 obj == self.ui.frm_box and event.type() == QtCore.QEvent.Paint:
66 painter = QtGui.QPainter()67 painter = QtGui.QPainter()
67 painter.begin(obj)68 painter.begin(obj)
68 painter.setRenderHint(QtGui.QPainter.Antialiasing, True)69 painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
6970
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/__init__.py'
--- ubuntuone/controlpanel/gui/qt/tests/__init__.py 2011-07-13 18:45:43 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/__init__.py 2011-07-19 19:17:30 +0000
@@ -40,6 +40,7 @@
40 "name": "desktop i5",40 "name": "desktop i5",
41 "is_local": False,41 "is_local": False,
42 "configurable": False,42 "configurable": False,
43 "device_id": '1258-6854',
43}44}
4445
45SAMPLE_PHONE_INFO = {46SAMPLE_PHONE_INFO = {
@@ -47,6 +48,7 @@
47 "name": "nokia 1100",48 "name": "nokia 1100",
48 "is_local": False,49 "is_local": False,
49 "configurable": False,50 "configurable": False,
51 "device_id": '987456-2321',
50}52}
5153
52SAMPLE_DEVICES_INFO = [54SAMPLE_DEVICES_INFO = [
@@ -55,6 +57,7 @@
55 "name": "toshiba laptop",57 "name": "toshiba laptop",
56 "is_local": True,58 "is_local": True,
57 "configurable": False,59 "configurable": False,
60 "device_id": '0000',
58 },61 },
59 SAMPLE_COMPUTER_INFO,62 SAMPLE_COMPUTER_INFO,
60 SAMPLE_PHONE_INFO,63 SAMPLE_PHONE_INFO,
6164
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_device.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_device.py 2011-07-13 18:45:43 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_device.py 2011-07-19 19:17:30 +0000
@@ -20,9 +20,20 @@
2020
21from PyQt4 import QtGui21from PyQt4 import QtGui
2222
23from twisted.internet import defer
24
23from ubuntuone.controlpanel.gui.qt import device as gui25from ubuntuone.controlpanel.gui.qt import device as gui
24from ubuntuone.controlpanel.gui.qt.tests import (BaseTestCase,26from ubuntuone.controlpanel.gui.qt.tests import (
25 SAMPLE_COMPUTER_INFO, SAMPLE_PHONE_INFO)27 BaseTestCase,
28 FakedConfirmDialog,
29 FakedControlPanelBackend,
30 SAMPLE_COMPUTER_INFO,
31 SAMPLE_PHONE_INFO,
32)
33
34# Access to a protected member
35# Instance of 'ControlBackend' has no '_called' member
36# pylint: disable=W0212, E1103
2637
2738
28class DeviceWidgetTestCase(BaseTestCase):39class DeviceWidgetTestCase(BaseTestCase):
@@ -31,6 +42,17 @@
31 innerclass_ui = gui.device_ui42 innerclass_ui = gui.device_ui
32 innerclass_name = "Ui_Form"43 innerclass_name = "Ui_Form"
33 class_ui = gui.DeviceWidget44 class_ui = gui.DeviceWidget
45 backend = FakedControlPanelBackend()
46 device_id = 'zaraza'
47 kwargs = {'backend': backend, 'device_id': device_id}
48
49 def test_has_id(self):
50 """The device as an id, None by default."""
51 self.assertEqual(self.ui.id, self.device_id)
52
53 def test_has_backend(self):
54 """The device as a backend, None by default."""
55 self.assertIs(self.ui.backend, self.backend)
3456
35 def test_update_device_info(self):57 def test_update_device_info(self):
36 """The widget is updated with the info."""58 """The widget is updated with the info."""
@@ -48,8 +70,8 @@
4870
49 def test_icon_name_from_type(self):71 def test_icon_name_from_type(self):
50 """Get the right icon name for a device type."""72 """Get the right icon name for a device type."""
51 self.assertIconMatchesType(gui.COMPUTER_TYPE, gui.COMPUTER_ICON)73 self.assertIconMatchesType(gui.DEVICE_TYPE_COMPUTER, gui.COMPUTER_ICON)
52 self.assertIconMatchesType(gui.PHONE_TYPE, gui.PHONE_ICON)74 self.assertIconMatchesType(gui.DEVICE_TYPE_PHONE, gui.PHONE_ICON)
53 self.assertIconMatchesType("other random type", gui.COMPUTER_ICON)75 self.assertIconMatchesType("other random type", gui.COMPUTER_ICON)
5476
55 def _test_update_device_info_sets_right_icon(self, info):77 def _test_update_device_info_sets_right_icon(self, info):
@@ -77,3 +99,66 @@
77 info = SAMPLE_PHONE_INFO99 info = SAMPLE_PHONE_INFO
78 item = gui.get_device_for_list_widget(info)100 item = gui.get_device_for_list_widget(info)
79 self.assertEqual(item.text(), info["name"])101 self.assertEqual(item.text(), info["name"])
102
103
104class RemoveDeviceTestCase(DeviceWidgetTestCase):
105 """The test suite for the device deletion."""
106
107 @defer.inlineCallbacks
108 def setUp(self):
109 yield super(RemoveDeviceTestCase, self).setUp()
110 FakedConfirmDialog.response = gui.NO
111 FakedConfirmDialog.args = None
112 FakedConfirmDialog.kwargs = None
113 self.patch(gui.QtGui, 'QMessageBox', FakedConfirmDialog)
114
115 def test_remove_device_opens_confirmation_dialog(self):
116 """A confirmation dialog is opened when user clicks 'delete device'."""
117 self.ui.ui.remove_device_button.click()
118
119 msg = gui.DEVICE_CONFIRM_REMOVE
120 buttons = gui.YES | gui.NO
121 self.assertEqual(FakedConfirmDialog.args,
122 (self.ui, '', msg, buttons, gui.NO))
123 self.assertEqual(FakedConfirmDialog.kwargs, {})
124
125 def test_remove_device_does_not_remove_if_answer_is_no(self):
126 """The device is not removed is answer is No."""
127 FakedConfirmDialog.response = gui.NO
128 self.ui.removed.connect(self._set_called)
129 self.ui.ui.remove_device_button.click()
130
131 self.assertNotIn('remove_device', self.ui.backend._called)
132 self.assertEqual(self._called, False)
133
134 def test_remove_device_does_remove_if_answer_is_yes(self):
135 """The device is removed is answer is Yes."""
136 FakedConfirmDialog.response = gui.YES
137 self.ui.ui.remove_device_button.click()
138
139 self.assert_backend_called('remove_device', device_id=self.device_id)
140
141 @defer.inlineCallbacks
142 def test_remove_device_emits_signal_when_removed(self):
143 """The signal 'removed' is emitted when removed."""
144 d = defer.Deferred()
145
146 def check(device_id):
147 """Fire deferred when the device was removed."""
148 d.callback(device_id)
149
150 FakedConfirmDialog.response = gui.YES
151 self.ui.removed.connect(self._set_called)
152 self.patch(self.ui.backend, 'remove_device', check)
153 self.ui.ui.remove_device_button.click()
154
155 yield d
156 self.assertEqual(self._called, ((), {}))
157
158 def test_remove_device_emits_signal_when_not_removed(self):
159 """The signal 'removeCanceled' is emitted when user cancels removal."""
160 FakedConfirmDialog.response = gui.NO
161 self.ui.removeCanceled.connect(self._set_called)
162 self.ui.ui.remove_device_button.click()
163
164 self.assertEqual(self._called, ((), {}))
80165
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_devices.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2011-07-11 11:19:09 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2011-07-19 19:17:30 +0000
@@ -22,6 +22,7 @@
2222
23from ubuntuone.controlpanel.gui.qt import devices as gui23from ubuntuone.controlpanel.gui.qt import devices as gui
24from ubuntuone.controlpanel.gui.qt.tests import (24from ubuntuone.controlpanel.gui.qt.tests import (
25 FakedConfirmDialog,
25 SAMPLE_DEVICES_INFO,26 SAMPLE_DEVICES_INFO,
26)27)
27from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import (28from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import (
@@ -40,6 +41,7 @@
40 def setUp(self):41 def setUp(self):
41 yield super(DevicesPanelTestCase, self).setUp()42 yield super(DevicesPanelTestCase, self).setUp()
42 self.ui.backend.next_result = SAMPLE_DEVICES_INFO43 self.ui.backend.next_result = SAMPLE_DEVICES_INFO
44 self.patch(gui.QtGui, 'QMessageBox', FakedConfirmDialog)
4345
44 def test_is_processing_while_asking_info(self):46 def test_is_processing_while_asking_info(self):
45 """The ui is processing while the contents are loaded."""47 """The ui is processing while the contents are loaded."""
@@ -76,9 +78,10 @@
76 local, remote = SAMPLE_DEVICES_INFO[0], SAMPLE_DEVICES_INFO[1:]78 local, remote = SAMPLE_DEVICES_INFO[0], SAMPLE_DEVICES_INFO[1:]
7779
78 self.assertEqual(self.ui.ui.local_device_box.count(), 1)80 self.assertEqual(self.ui.ui.local_device_box.count(), 1)
79 local_device = self.ui.ui.local_device_box.itemAt(0)81 local_device = self.ui.ui.local_device_box.itemAt(0).widget()
80 self.assertEqual(local_device.widget().ui.device_name_label.text(),82 self.assertEqual(local_device.ui.device_name_label.text(),
81 local['name'])83 local['name'])
84 self.assertEqual(local_device.id, local['device_id'])
8285
83 self.assertEqual(self.ui.ui.list_devices.count(),86 self.assertEqual(self.ui.ui.list_devices.count(),
84 len(remote))87 len(remote))
@@ -97,3 +100,12 @@
97 self.ui.ui.manage_devices_button.click()100 self.ui.ui.manage_devices_button.click()
98101
99 self.assertEqual(self._called, ((gui.EDIT_DEVICES_LINK,), {}))102 self.assertEqual(self._called, ((gui.EDIT_DEVICES_LINK,), {}))
103
104 def test_remove_device_widget_after_removal(self):
105 """When a device widget was deleted, remove it from the UI."""
106 self.ui.process_info(SAMPLE_DEVICES_INFO)
107
108 local_device = self.ui.ui.local_device_box.itemAt(0).widget()
109 local_device.removed.emit()
110
111 self.assertTrue(self.ui.ui.local_device_box.itemAt(0) is None)
100112
=== modified file 'ubuntuone/controlpanel/gui/tests/__init__.py'
--- ubuntuone/controlpanel/gui/tests/__init__.py 2011-07-01 12:39:37 +0000
+++ ubuntuone/controlpanel/gui/tests/__init__.py 2011-07-19 19:17:30 +0000
@@ -21,7 +21,11 @@
21import os21import os
2222
23from ubuntuone.controlpanel import gui23from ubuntuone.controlpanel import gui
24from ubuntuone.controlpanel.backend import ControlBackend24from ubuntuone.controlpanel.backend import (
25 ControlBackend,
26 DEVICE_TYPE_COMPUTER,
27 DEVICE_TYPE_PHONE,
28)
25from ubuntuone.controlpanel.tests import USER_HOME, ROOT_PATH29from ubuntuone.controlpanel.tests import USER_HOME, ROOT_PATH
2630
27# Attribute 'yyy' defined outside __init__, access to a protected member31# Attribute 'yyy' defined outside __init__, access to a protected member
@@ -95,22 +99,27 @@
95FAKE_VOLUMES_MINIMAL_INFO = [(u'', u'147852369', [ROOT, MUSIC_FOLDER])]99FAKE_VOLUMES_MINIMAL_INFO = [(u'', u'147852369', [ROOT, MUSIC_FOLDER])]
96100
97FAKE_DEVICE_INFO = {101FAKE_DEVICE_INFO = {
98 'device_id': '1258-6854', 'device_name': 'Baz', 'device_type': 'Computer',102 'device_id': '1258-6854', 'device_name': 'Baz',
103 'device_type': DEVICE_TYPE_COMPUTER,
99 'is_local': 'True', 'configurable': 'True', 'limit_bandwidth': 'True',104 'is_local': 'True', 'configurable': 'True', 'limit_bandwidth': 'True',
100 'max_upload_speed': '1000', 'max_download_speed': '72548',105 'max_upload_speed': '1000', 'max_download_speed': '72548',
101 'show_all_notifications': 'True',106 'show_all_notifications': 'True',
102}107}
103108
104FAKE_DEVICES_INFO = [109FAKE_DEVICES_INFO = [
105 {'device_id': '0', 'name': 'Ubuntu One @ Foo', 'type': 'Computer',110 {'device_id': '0', 'name': 'Ubuntu One @ Foo',
106 'is_local': '', 'configurable': ''},111 'type': DEVICE_TYPE_COMPUTER,
107 {'device_id': '1', 'name': 'Ubuntu One @ Bar', 'type': 'Phone',112 'is_local': '', 'configurable': ''},
108 'is_local': '', 'configurable': ''},113 {'device_id': '1', 'name': 'Ubuntu One @ Bar',
109 {'device_id': '2', 'name': 'Ubuntu One @ Z', 'type': 'Computer',114 'type': DEVICE_TYPE_PHONE,
115 'is_local': '', 'configurable': ''},
116 {'device_id': '2', 'name': 'Ubuntu One @ Z',
117 'type': DEVICE_TYPE_COMPUTER,
110 'is_local': '', 'configurable': 'True', 'limit_bandwidth': '',118 'is_local': '', 'configurable': 'True', 'limit_bandwidth': '',
111 'max_upload_speed': '0', 'max_download_speed': '0',119 'max_upload_speed': '0', 'max_download_speed': '0',
112 'show_all_notifications': ''},120 'show_all_notifications': ''},
113 {'device_id': '1258-6854', 'name': 'Ubuntu One @ Baz', 'type': 'Computer',121 {'device_id': '1258-6854', 'name': 'Ubuntu One @ Baz',
122 'type': DEVICE_TYPE_COMPUTER,
114 'is_local': 'True', 'configurable': 'True', 'limit_bandwidth': 'True',123 'is_local': 'True', 'configurable': 'True', 'limit_bandwidth': 'True',
115 'max_upload_speed': '1000', 'max_download_speed': '72548',124 'max_upload_speed': '1000', 'max_download_speed': '72548',
116 'show_all_notifications': 'True'}, # local125 'show_all_notifications': 'True'}, # local

Subscribers

People subscribed via source and target branches