Merge lp:~ralsina/ubuntuone-control-panel/lang-tested into lp:ubuntuone-control-panel

Proposed by Roberto Alsina on 2012-03-12
Status: Merged
Approved by: Roberto Alsina on 2012-03-12
Approved revision: 285
Merged at revision: 282
Proposed branch: lp:~ralsina/ubuntuone-control-panel/lang-tested
Merge into: lp:ubuntuone-control-panel
Diff against target: 210 lines (+32/-26)
8 files modified
ubuntuone/controlpanel/gui/qt/tests/test_account.py (+4/-4)
ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py (+4/-3)
ubuntuone/controlpanel/gui/qt/tests/test_device.py (+2/-1)
ubuntuone/controlpanel/gui/qt/tests/test_devices.py (+3/-3)
ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py (+6/-4)
ubuntuone/controlpanel/gui/qt/tests/test_folders.py (+8/-7)
ubuntuone/controlpanel/gui/qt/tests/test_signin.py (+4/-3)
ubuntuone/controlpanel/gui/qt/tests/test_wizard.py (+1/-1)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/lang-tested
Reviewer Review Type Date Requested Status
Natalia Bidart Approve on 2012-03-12
dobey (community) 2012-03-12 Approve on 2012-03-12
Review via email: mp+97064@code.launchpad.net

Commit message

- Fixed tests so they work under non-english locales (Fixes LP: #951716).

Description of the change

 - Fixed tests so they work under non-english locales (Fixes LP: #951716).

To post a comment you must log in.
dobey (dobey) :
review: Approve
Natalia Bidart (nataliabidart) 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 'ubuntuone/controlpanel/gui/qt/tests/test_account.py'
2--- ubuntuone/controlpanel/gui/qt/tests/test_account.py 2012-03-01 22:05:51 +0000
3+++ ubuntuone/controlpanel/gui/qt/tests/test_account.py 2012-03-12 17:04:25 +0000
4@@ -62,10 +62,10 @@
5 def test_process_info(self):
6 """The info is processed when ready."""
7 self.ui.process_info(SAMPLE_ACCOUNT_INFO)
8- self.assertEqual(self.ui.ui.name_label.text(), SAMPLE_NAME)
9- self.assertEqual(self.ui.ui.email_label.text(), SAMPLE_EMAIL)
10- self.assertEqual(self.ui.ui.services_description_label.text(),
11- SAMPLE_PLAN)
12+ self.assertEqual(unicode(self.ui.ui.name_label.text()), SAMPLE_NAME)
13+ self.assertEqual(unicode(self.ui.ui.email_label.text()), SAMPLE_EMAIL)
14+ self.assertEqual(unicode(
15+ self.ui.ui.services_description_label.text()), SAMPLE_PLAN)
16
17 def test_edit_account_button(self):
18 """When clicking the edit account button, the proper url is opened."""
19
20=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py'
21--- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-02 17:13:04 +0000
22+++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-12 17:04:25 +0000
23@@ -107,7 +107,7 @@
24
25 name = gui.NAME_STYLE % SAMPLE_NAME
26 greeting = gui.GREETING % {'user_display_name': name}
27- self.assertEqual(self.ui.ui.greeting_label.text(), greeting)
28+ self.assertEqual(unicode(self.ui.ui.greeting_label.text()), greeting)
29
30 used = int(info['quota_used'])
31 total = int(info['quota_total'])
32@@ -116,9 +116,10 @@
33 expected = {'used': gui.humanize(used),
34 'total': gui.humanize(total)}
35 msg = gui.USAGE_LABEL % expected
36- self.assertEqual(self.ui.ui.quota_usage_label.text(), msg)
37+ self.assertEqual(unicode(self.ui.ui.quota_usage_label.text()), msg)
38 msg = gui.PERCENTAGE_LABEL % percentage_usage
39- self.assertEqual(self.ui.ui.percentage_usage_label.text(), msg)
40+ self.assertEqual(unicode(self.ui.ui.percentage_usage_label.text()),
41+ msg)
42
43 def test_update_over_quota(self):
44 """Check the labels state when the user exceed the quota."""
45
46=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_device.py'
47--- ubuntuone/controlpanel/gui/qt/tests/test_device.py 2012-03-08 20:46:13 +0000
48+++ ubuntuone/controlpanel/gui/qt/tests/test_device.py 2012-03-12 17:04:25 +0000
49@@ -71,7 +71,8 @@
50 info = SAMPLE_COMPUTER_INFO
51 expected_name = info["name"]
52 self.ui.update_device_info(info)
53- self.assertEqual(self.ui.ui.device_name_label.text(), expected_name)
54+ self.assertEqual(unicode(self.ui.ui.device_name_label.text()),
55+ expected_name)
56
57 # pylint: disable=C0103
58 def assertIconMatchesType(self, device_type, base_icon_name):
59
60=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_devices.py'
61--- ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2012-03-08 20:46:13 +0000
62+++ ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2012-03-12 17:04:25 +0000
63@@ -69,7 +69,7 @@
64 local, remote = SAMPLE_DEVICES_INFO[0], SAMPLE_DEVICES_INFO[1:]
65
66 local_device = self.ui.ui.local_device
67- self.assertEqual(local_device.text(), local['name'])
68+ self.assertEqual(unicode(local_device.text()), local['name'])
69 self.assertEqual(local_device.id, local['device_id'])
70
71 self.assertEqual(self.ui.ui.list_devices.count(),
72@@ -77,7 +77,7 @@
73 for i, remote_device in enumerate(remote):
74 item = self.ui.ui.list_devices.item(i)
75 device = self.ui.ui.list_devices.itemWidget(item)
76- self.assertEqual(device.text(), remote_device['name'])
77+ self.assertEqual(unicode(device.text()), remote_device['name'])
78
79 def test_local_device(self):
80 """Test if the local_device widget is properly packed."""
81@@ -102,7 +102,7 @@
82
83 self.ui.ui.local_device.removed.emit()
84
85- self.assertEqual(self.ui.ui.local_device.text(), '')
86+ self.assertEqual(unicode(self.ui.ui.local_device.text()), '')
87 self.assertEqual(self.ui.ui.local_device.id, None)
88
89 def test_local_device_removed_signal(self):
90
91=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py'
92--- ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-03-02 13:53:24 +0000
93+++ ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-03-12 17:04:25 +0000
94@@ -60,7 +60,7 @@
95 status = {backend.STATUS_KEY: status_bd, backend.MSG_KEY: msg_bd}
96 self.ui.process_info(status)
97
98- actual_text = self.ui.ui.sync_status_label.text()
99+ actual_text = unicode(self.ui.ui.sync_status_label.text())
100 self.assertEqual(expected_text, actual_text)
101
102 actual_icon = self.ui.ui.sync_status_icon.pixmap()
103@@ -69,7 +69,8 @@
104 self.assertEqualPixmaps(expected_icon, actual_icon)
105
106 self.assertTrue(self.ui.ui.sync_status_button.isEnabled())
107- self.assertEqual(self.ui.ui.sync_status_button.text(), action)
108+ self.assertEqual(unicode(self.ui.ui.sync_status_button.text()),
109+ action)
110
111 is_default = self.ui.ui.sync_status_button.isDefault()
112 expected_default = (action == gui.FILE_SYNC_CONNECT)
113@@ -180,9 +181,10 @@
114
115 self.assertFalse(self.ui.ui.sync_status_button.isEnabled())
116 self.assertFalse(self.ui.ui.sync_status_button.isDefault())
117- actual_text = self.ui.ui.sync_status_label.text()
118+ actual_text = unicode(self.ui.ui.sync_status_label.text())
119 self.assertEqual(actual_text, LOADING)
120- self.assertEqual(self.ui.ui.sync_status_button.text(), PLEASE_WAIT)
121+ self.assertEqual(unicode(self.ui.ui.sync_status_button.text()),
122+ PLEASE_WAIT)
123 actual_icon = self.ui.ui.sync_status_icon.pixmap()
124 expected_icon = gui.pixmap_from_name('sync_status_loading')
125 self.assertEqualPixmaps(expected_icon, actual_icon)
126
127=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py'
128--- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-08 20:46:13 +0000
129+++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-12 17:04:25 +0000
130@@ -61,7 +61,8 @@
131
132 def test_text(self):
133 """The button text is correct."""
134- self.assertEqual(self.ui.text(), gui.FOLDERS_COLUMN_EXPLORE)
135+ self.assertEqual(unicode(self.ui.text()),
136+ gui.FOLDERS_COLUMN_EXPLORE)
137
138 def test_clicked(self):
139 """Clicking the button opens the folder in the default file manager."""
140@@ -105,10 +106,10 @@
141
142 def assert_folder_group_header_correct(self, item, name):
143 """Check that the folder group header is correct."""
144- self.assertEqual(item.text(gui.FOLDER_NAME_COL), name)
145- self.assertEqual(item.text(gui.SUBSCRIPTION_COL),
146+ self.assertEqual(unicode(item.text(gui.FOLDER_NAME_COL)), name)
147+ self.assertEqual(unicode(item.text(gui.SUBSCRIPTION_COL)),
148 gui.FOLDERS_COLUMN_SYNC_LOCALLY)
149- self.assertEqual(item.text(gui.EXPLORE_COL), '')
150+ self.assertEqual(unicode(item.text(gui.EXPLORE_COL)), '')
151
152 @defer.inlineCallbacks
153 def test_is_processing_while_asking_info(self):
154@@ -163,12 +164,12 @@
155 if volume['type'] == self.ui.backend.SHARE_TYPE:
156 name = volume['name']
157 expected_path = volume['realpath']
158- label = item.text(gui.FOLDER_NAME_COL)
159+ label = unicode(item.text(gui.FOLDER_NAME_COL))
160 self.assertEqual(label, name)
161
162 if volume['type'] == self.ui.backend.ROOT_TYPE:
163 # no check box but the ALWAYS_SUBSCRIBED legend
164- self.assertEqual(item.text(gui.SUBSCRIPTION_COL),
165+ self.assertEqual(unicode(item.text(gui.SUBSCRIPTION_COL)),
166 gui.ALWAYS_SUBSCRIBED)
167 else:
168 subscribed = item.checkState(gui.SUBSCRIPTION_COL) == \
169@@ -318,7 +319,7 @@
170
171 volume = MUSIC_FOLDER
172
173- label = item.text(gui.FOLDER_NAME_COL)
174+ label = unicode(item.text(gui.FOLDER_NAME_COL))
175 self.assertEqual(label, gui.MUSIC_DISPLAY_NAME)
176
177 subscribed = item.checkState(gui.SUBSCRIPTION_COL) == gui.CHECKED
178
179=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_signin.py'
180--- ubuntuone/controlpanel/gui/qt/tests/test_signin.py 2012-03-02 17:13:04 +0000
181+++ ubuntuone/controlpanel/gui/qt/tests/test_signin.py 2012-03-12 17:04:25 +0000
182@@ -47,11 +47,12 @@
183
184 def test_label_is_correct(self):
185 """The welcome_label has the correct text."""
186- self.assertEqual(self.ui.ui.welcome_label.text(), gui.WELCOME_LABEL)
187+ self.assertEqual(unicode(self.ui.ui.welcome_label.text()),
188+ gui.WELCOME_LABEL)
189
190 def test_buttos_are_correct(self):
191 """The buttos have the correct text."""
192- self.assertEqual(self.ui.ui.login_button.text(),
193+ self.assertEqual(unicode(self.ui.ui.login_button.text()),
194 gui.EXISTING_ACCOUNT_CHOICE_BUTTON)
195- self.assertEqual(self.ui.ui.register_button.text(),
196+ self.assertEqual(unicode(self.ui.ui.register_button.text()),
197 gui.SET_UP_ACCOUNT_CHOICE_BUTTON)
198
199=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py'
200--- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-02 17:13:04 +0000
201+++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-12 17:04:25 +0000
202@@ -43,7 +43,7 @@
203 def test_cancel_button(self):
204 """Send the rejected signal when the cancel button is clicked."""
205 button = self.ui.button(self.ui.CancelButton)
206- self.assertEqual(button.text(), gui.CLOSE_AND_SETUP_LATER)
207+ self.assertEqual(unicode(button.text()), gui.CLOSE_AND_SETUP_LATER)
208
209 self.ui.rejected.connect(self._set_called)
210 button.click()

Subscribers

People subscribed via source and target branches