Merge lp:~sil2100/unity/autopilot_fix_cmd_locale into lp:unity

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 2879
Merged at revision: 2882
Proposed branch: lp:~sil2100/unity/autopilot_fix_cmd_locale
Merge into: lp:unity
Diff against target: 44 lines (+5/-3)
1 file modified
tests/autopilot/unity/tests/test_command_lens.py (+5/-3)
To merge this branch: bzr merge lp:~sil2100/unity/autopilot_fix_cmd_locale
Reviewer Review Type Date Requested Status
Timo Jyrinki code Approve
MC Return (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+133203@code.launchpad.net

Commit message

The command lens autopilot tests were failing on non-EN locales, since there is no category with the name "Results" there. Let's use gettext.

Description of the change

- Problem:

test_command_lens test cases fail on non-EN locale.

- Fix:

Locale dependent values should first get translated with a gettext call.

- Tests:

None, autopilot test fix.

To post a comment you must log in.
MC Return (mc-return) wrote :

LGTM.

review: Approve
Timo Jyrinki (timo-jyrinki) wrote :

Works great in Finnish too! :)

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/unity/tests/test_command_lens.py'
--- tests/autopilot/unity/tests/test_command_lens.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/tests/test_command_lens.py 2012-11-07 09:50:25 +0000
@@ -14,12 +14,14 @@
1414
15from unity.tests import UnityTestCase15from unity.tests import UnityTestCase
1616
17import gettext
1718
18class CommandLensSearchTests(UnityTestCase):19class CommandLensSearchTests(UnityTestCase):
19 """Test the command lense search bahavior."""20 """Test the command lense search bahavior."""
2021
21 def setUp(self):22 def setUp(self):
22 super(CommandLensSearchTests, self).setUp()23 super(CommandLensSearchTests, self).setUp()
24 gettext.install("unity-lens-applications")
2325
24 def tearDown(self):26 def tearDown(self):
25 self.dash.ensure_hidden()27 self.dash.ensure_hidden()
@@ -34,7 +36,7 @@
34 self.keyboard.press_and_release("Delete")36 self.keyboard.press_and_release("Delete")
3537
36 self.assertThat(self.dash.search_string, Eventually(Equals("")))38 self.assertThat(self.dash.search_string, Eventually(Equals("")))
37 results_category = command_lens.get_category_by_name("Results")39 results_category = command_lens.get_category_by_name(_("Results"))
38 self.assertThat(results_category.is_visible, Eventually(Equals(False)))40 self.assertThat(results_category.is_visible, Eventually(Equals(False)))
3941
40 def test_results_category_appears(self):42 def test_results_category_appears(self):
@@ -44,7 +46,7 @@
44 # lots of apps start with 'a'...46 # lots of apps start with 'a'...
45 self.keyboard.type("a")47 self.keyboard.type("a")
46 self.assertThat(self.dash.search_string, Eventually(Equals("a")))48 self.assertThat(self.dash.search_string, Eventually(Equals("a")))
47 results_category = command_lens.get_category_by_name("Results")49 results_category = command_lens.get_category_by_name(_("Results"))
48 self.assertThat(results_category.is_visible, Eventually(Equals(True)))50 self.assertThat(results_category.is_visible, Eventually(Equals(True)))
4951
50 def test_result_category_actually_contains_results(self):52 def test_result_category_actually_contains_results(self):
@@ -54,7 +56,7 @@
54 # lots of apps start with 'a'...56 # lots of apps start with 'a'...
55 self.keyboard.type("a")57 self.keyboard.type("a")
56 self.assertThat(self.dash.search_string, Eventually(Equals("a")))58 self.assertThat(self.dash.search_string, Eventually(Equals("a")))
57 results_category = command_lens.get_category_by_name("Results")59 results_category = command_lens.get_category_by_name(_("Results"))
58 results = results_category.get_results()60 results = results_category.get_results()
59 self.assertTrue(results)61 self.assertTrue(results)
6062