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

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
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 (community) Approve
dobey (community) Approve
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.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
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
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_account.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_account.py 2012-03-01 22:05:51 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_account.py 2012-03-12 17:04:25 +0000
@@ -62,10 +62,10 @@
62 def test_process_info(self):62 def test_process_info(self):
63 """The info is processed when ready."""63 """The info is processed when ready."""
64 self.ui.process_info(SAMPLE_ACCOUNT_INFO)64 self.ui.process_info(SAMPLE_ACCOUNT_INFO)
65 self.assertEqual(self.ui.ui.name_label.text(), SAMPLE_NAME)65 self.assertEqual(unicode(self.ui.ui.name_label.text()), SAMPLE_NAME)
66 self.assertEqual(self.ui.ui.email_label.text(), SAMPLE_EMAIL)66 self.assertEqual(unicode(self.ui.ui.email_label.text()), SAMPLE_EMAIL)
67 self.assertEqual(self.ui.ui.services_description_label.text(),67 self.assertEqual(unicode(
68 SAMPLE_PLAN)68 self.ui.ui.services_description_label.text()), SAMPLE_PLAN)
6969
70 def test_edit_account_button(self):70 def test_edit_account_button(self):
71 """When clicking the edit account button, the proper url is opened."""71 """When clicking the edit account button, the proper url is opened."""
7272
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-02 17:13:04 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-12 17:04:25 +0000
@@ -107,7 +107,7 @@
107107
108 name = gui.NAME_STYLE % SAMPLE_NAME108 name = gui.NAME_STYLE % SAMPLE_NAME
109 greeting = gui.GREETING % {'user_display_name': name}109 greeting = gui.GREETING % {'user_display_name': name}
110 self.assertEqual(self.ui.ui.greeting_label.text(), greeting)110 self.assertEqual(unicode(self.ui.ui.greeting_label.text()), greeting)
111111
112 used = int(info['quota_used'])112 used = int(info['quota_used'])
113 total = int(info['quota_total'])113 total = int(info['quota_total'])
@@ -116,9 +116,10 @@
116 expected = {'used': gui.humanize(used),116 expected = {'used': gui.humanize(used),
117 'total': gui.humanize(total)}117 'total': gui.humanize(total)}
118 msg = gui.USAGE_LABEL % expected118 msg = gui.USAGE_LABEL % expected
119 self.assertEqual(self.ui.ui.quota_usage_label.text(), msg)119 self.assertEqual(unicode(self.ui.ui.quota_usage_label.text()), msg)
120 msg = gui.PERCENTAGE_LABEL % percentage_usage120 msg = gui.PERCENTAGE_LABEL % percentage_usage
121 self.assertEqual(self.ui.ui.percentage_usage_label.text(), msg)121 self.assertEqual(unicode(self.ui.ui.percentage_usage_label.text()),
122 msg)
122123
123 def test_update_over_quota(self):124 def test_update_over_quota(self):
124 """Check the labels state when the user exceed the quota."""125 """Check the labels state when the user exceed the quota."""
125126
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_device.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_device.py 2012-03-08 20:46:13 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_device.py 2012-03-12 17:04:25 +0000
@@ -71,7 +71,8 @@
71 info = SAMPLE_COMPUTER_INFO71 info = SAMPLE_COMPUTER_INFO
72 expected_name = info["name"]72 expected_name = info["name"]
73 self.ui.update_device_info(info)73 self.ui.update_device_info(info)
74 self.assertEqual(self.ui.ui.device_name_label.text(), expected_name)74 self.assertEqual(unicode(self.ui.ui.device_name_label.text()),
75 expected_name)
7576
76 # pylint: disable=C010377 # pylint: disable=C0103
77 def assertIconMatchesType(self, device_type, base_icon_name):78 def assertIconMatchesType(self, device_type, base_icon_name):
7879
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_devices.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2012-03-08 20:46:13 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2012-03-12 17:04:25 +0000
@@ -69,7 +69,7 @@
69 local, remote = SAMPLE_DEVICES_INFO[0], SAMPLE_DEVICES_INFO[1:]69 local, remote = SAMPLE_DEVICES_INFO[0], SAMPLE_DEVICES_INFO[1:]
7070
71 local_device = self.ui.ui.local_device71 local_device = self.ui.ui.local_device
72 self.assertEqual(local_device.text(), local['name'])72 self.assertEqual(unicode(local_device.text()), local['name'])
73 self.assertEqual(local_device.id, local['device_id'])73 self.assertEqual(local_device.id, local['device_id'])
7474
75 self.assertEqual(self.ui.ui.list_devices.count(),75 self.assertEqual(self.ui.ui.list_devices.count(),
@@ -77,7 +77,7 @@
77 for i, remote_device in enumerate(remote):77 for i, remote_device in enumerate(remote):
78 item = self.ui.ui.list_devices.item(i)78 item = self.ui.ui.list_devices.item(i)
79 device = self.ui.ui.list_devices.itemWidget(item)79 device = self.ui.ui.list_devices.itemWidget(item)
80 self.assertEqual(device.text(), remote_device['name'])80 self.assertEqual(unicode(device.text()), remote_device['name'])
8181
82 def test_local_device(self):82 def test_local_device(self):
83 """Test if the local_device widget is properly packed."""83 """Test if the local_device widget is properly packed."""
@@ -102,7 +102,7 @@
102102
103 self.ui.ui.local_device.removed.emit()103 self.ui.ui.local_device.removed.emit()
104104
105 self.assertEqual(self.ui.ui.local_device.text(), '')105 self.assertEqual(unicode(self.ui.ui.local_device.text()), '')
106 self.assertEqual(self.ui.ui.local_device.id, None)106 self.assertEqual(self.ui.ui.local_device.id, None)
107107
108 def test_local_device_removed_signal(self):108 def test_local_device_removed_signal(self):
109109
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-03-02 13:53:24 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_filesyncstatus.py 2012-03-12 17:04:25 +0000
@@ -60,7 +60,7 @@
60 status = {backend.STATUS_KEY: status_bd, backend.MSG_KEY: msg_bd}60 status = {backend.STATUS_KEY: status_bd, backend.MSG_KEY: msg_bd}
61 self.ui.process_info(status)61 self.ui.process_info(status)
6262
63 actual_text = self.ui.ui.sync_status_label.text()63 actual_text = unicode(self.ui.ui.sync_status_label.text())
64 self.assertEqual(expected_text, actual_text)64 self.assertEqual(expected_text, actual_text)
6565
66 actual_icon = self.ui.ui.sync_status_icon.pixmap()66 actual_icon = self.ui.ui.sync_status_icon.pixmap()
@@ -69,7 +69,8 @@
69 self.assertEqualPixmaps(expected_icon, actual_icon)69 self.assertEqualPixmaps(expected_icon, actual_icon)
7070
71 self.assertTrue(self.ui.ui.sync_status_button.isEnabled())71 self.assertTrue(self.ui.ui.sync_status_button.isEnabled())
72 self.assertEqual(self.ui.ui.sync_status_button.text(), action)72 self.assertEqual(unicode(self.ui.ui.sync_status_button.text()),
73 action)
7374
74 is_default = self.ui.ui.sync_status_button.isDefault()75 is_default = self.ui.ui.sync_status_button.isDefault()
75 expected_default = (action == gui.FILE_SYNC_CONNECT)76 expected_default = (action == gui.FILE_SYNC_CONNECT)
@@ -180,9 +181,10 @@
180181
181 self.assertFalse(self.ui.ui.sync_status_button.isEnabled())182 self.assertFalse(self.ui.ui.sync_status_button.isEnabled())
182 self.assertFalse(self.ui.ui.sync_status_button.isDefault())183 self.assertFalse(self.ui.ui.sync_status_button.isDefault())
183 actual_text = self.ui.ui.sync_status_label.text()184 actual_text = unicode(self.ui.ui.sync_status_label.text())
184 self.assertEqual(actual_text, LOADING)185 self.assertEqual(actual_text, LOADING)
185 self.assertEqual(self.ui.ui.sync_status_button.text(), PLEASE_WAIT)186 self.assertEqual(unicode(self.ui.ui.sync_status_button.text()),
187 PLEASE_WAIT)
186 actual_icon = self.ui.ui.sync_status_icon.pixmap()188 actual_icon = self.ui.ui.sync_status_icon.pixmap()
187 expected_icon = gui.pixmap_from_name('sync_status_loading')189 expected_icon = gui.pixmap_from_name('sync_status_loading')
188 self.assertEqualPixmaps(expected_icon, actual_icon)190 self.assertEqualPixmaps(expected_icon, actual_icon)
189191
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-08 20:46:13 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-12 17:04:25 +0000
@@ -61,7 +61,8 @@
6161
62 def test_text(self):62 def test_text(self):
63 """The button text is correct."""63 """The button text is correct."""
64 self.assertEqual(self.ui.text(), gui.FOLDERS_COLUMN_EXPLORE)64 self.assertEqual(unicode(self.ui.text()),
65 gui.FOLDERS_COLUMN_EXPLORE)
6566
66 def test_clicked(self):67 def test_clicked(self):
67 """Clicking the button opens the folder in the default file manager."""68 """Clicking the button opens the folder in the default file manager."""
@@ -105,10 +106,10 @@
105106
106 def assert_folder_group_header_correct(self, item, name):107 def assert_folder_group_header_correct(self, item, name):
107 """Check that the folder group header is correct."""108 """Check that the folder group header is correct."""
108 self.assertEqual(item.text(gui.FOLDER_NAME_COL), name)109 self.assertEqual(unicode(item.text(gui.FOLDER_NAME_COL)), name)
109 self.assertEqual(item.text(gui.SUBSCRIPTION_COL),110 self.assertEqual(unicode(item.text(gui.SUBSCRIPTION_COL)),
110 gui.FOLDERS_COLUMN_SYNC_LOCALLY)111 gui.FOLDERS_COLUMN_SYNC_LOCALLY)
111 self.assertEqual(item.text(gui.EXPLORE_COL), '')112 self.assertEqual(unicode(item.text(gui.EXPLORE_COL)), '')
112113
113 @defer.inlineCallbacks114 @defer.inlineCallbacks
114 def test_is_processing_while_asking_info(self):115 def test_is_processing_while_asking_info(self):
@@ -163,12 +164,12 @@
163 if volume['type'] == self.ui.backend.SHARE_TYPE:164 if volume['type'] == self.ui.backend.SHARE_TYPE:
164 name = volume['name']165 name = volume['name']
165 expected_path = volume['realpath']166 expected_path = volume['realpath']
166 label = item.text(gui.FOLDER_NAME_COL)167 label = unicode(item.text(gui.FOLDER_NAME_COL))
167 self.assertEqual(label, name)168 self.assertEqual(label, name)
168169
169 if volume['type'] == self.ui.backend.ROOT_TYPE:170 if volume['type'] == self.ui.backend.ROOT_TYPE:
170 # no check box but the ALWAYS_SUBSCRIBED legend171 # no check box but the ALWAYS_SUBSCRIBED legend
171 self.assertEqual(item.text(gui.SUBSCRIPTION_COL),172 self.assertEqual(unicode(item.text(gui.SUBSCRIPTION_COL)),
172 gui.ALWAYS_SUBSCRIBED)173 gui.ALWAYS_SUBSCRIBED)
173 else:174 else:
174 subscribed = item.checkState(gui.SUBSCRIPTION_COL) == \175 subscribed = item.checkState(gui.SUBSCRIPTION_COL) == \
@@ -318,7 +319,7 @@
318319
319 volume = MUSIC_FOLDER320 volume = MUSIC_FOLDER
320321
321 label = item.text(gui.FOLDER_NAME_COL)322 label = unicode(item.text(gui.FOLDER_NAME_COL))
322 self.assertEqual(label, gui.MUSIC_DISPLAY_NAME)323 self.assertEqual(label, gui.MUSIC_DISPLAY_NAME)
323324
324 subscribed = item.checkState(gui.SUBSCRIPTION_COL) == gui.CHECKED325 subscribed = item.checkState(gui.SUBSCRIPTION_COL) == gui.CHECKED
325326
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_signin.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_signin.py 2012-03-02 17:13:04 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_signin.py 2012-03-12 17:04:25 +0000
@@ -47,11 +47,12 @@
4747
48 def test_label_is_correct(self):48 def test_label_is_correct(self):
49 """The welcome_label has the correct text."""49 """The welcome_label has the correct text."""
50 self.assertEqual(self.ui.ui.welcome_label.text(), gui.WELCOME_LABEL)50 self.assertEqual(unicode(self.ui.ui.welcome_label.text()),
51 gui.WELCOME_LABEL)
5152
52 def test_buttos_are_correct(self):53 def test_buttos_are_correct(self):
53 """The buttos have the correct text."""54 """The buttos have the correct text."""
54 self.assertEqual(self.ui.ui.login_button.text(),55 self.assertEqual(unicode(self.ui.ui.login_button.text()),
55 gui.EXISTING_ACCOUNT_CHOICE_BUTTON)56 gui.EXISTING_ACCOUNT_CHOICE_BUTTON)
56 self.assertEqual(self.ui.ui.register_button.text(),57 self.assertEqual(unicode(self.ui.ui.register_button.text()),
57 gui.SET_UP_ACCOUNT_CHOICE_BUTTON)58 gui.SET_UP_ACCOUNT_CHOICE_BUTTON)
5859
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-02 17:13:04 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-12 17:04:25 +0000
@@ -43,7 +43,7 @@
43 def test_cancel_button(self):43 def test_cancel_button(self):
44 """Send the rejected signal when the cancel button is clicked."""44 """Send the rejected signal when the cancel button is clicked."""
45 button = self.ui.button(self.ui.CancelButton)45 button = self.ui.button(self.ui.CancelButton)
46 self.assertEqual(button.text(), gui.CLOSE_AND_SETUP_LATER)46 self.assertEqual(unicode(button.text()), gui.CLOSE_AND_SETUP_LATER)
4747
48 self.ui.rejected.connect(self._set_called)48 self.ui.rejected.connect(self._set_called)
49 button.click()49 button.click()

Subscribers

People subscribed via source and target branches