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

Proposed by Łukasz Zemczak on 2012-11-09
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2012-11-12
Approved revision: 2889
Merged at revision: 2889
Proposed branch: lp:~sil2100/unity/autopilot_shopping_fix
Merge into: lp:unity
Diff against target: 77 lines (+10/-8)
1 file modified
tests/autopilot/unity/tests/test_shopping_lens.py (+10/-8)
To merge this branch: bzr merge lp:~sil2100/unity/autopilot_shopping_fix
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) 2012-11-09 Approve on 2012-11-12
PS Jenkins bot continuous-integration Pending
Review via email: mp+133738@code.launchpad.net

Commit message

For the shopping lens tests - 'a' is not a sufficient search string, use something that is more likely to result some results. Also, make it locale independent by using gettext translations for categories.

Description of the change

- Problem:

Tests fail due to "a" search string not returning any shopping results. The tests are also failing on non-EN locale.

- Fix:

Use a string more probable in returning shopping results, e.g. "playstation". We also gettext the category values for different locale.

- Tests:

N/A

To post a comment you must log in.
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity/tests/test_shopping_lens.py'
2--- tests/autopilot/unity/tests/test_shopping_lens.py 2012-09-24 23:42:16 +0000
3+++ tests/autopilot/unity/tests/test_shopping_lens.py 2012-11-09 19:05:28 +0000
4@@ -12,6 +12,7 @@
5 from testtools.matchers import Equals, GreaterThan
6 from time import sleep
7 import urllib2
8+import gettext
9
10 from unity.tests import UnityTestCase
11
12@@ -25,6 +26,7 @@
13 urllib2.urlopen("http://www.google.com", timeout=2)
14 except urllib2.URLError, e:
15 self.skip("Skipping test, no internet connection")
16+ gettext.install("unity-lens-shopping")
17
18 def tearDown(self):
19 self.dash.ensure_hidden()
20@@ -35,7 +37,7 @@
21 self.dash.ensure_visible()
22 lens = self.dash.get_current_lens()
23
24- results_category = lens.get_category_by_name("More suggestions")
25+ results_category = lens.get_category_by_name(_("More suggestions"))
26 refresh_results_fn = lambda: len(results_category.get_results())
27 self.assertThat(refresh_results_fn, Eventually(Equals(0)))
28
29@@ -45,7 +47,7 @@
30 lens = self.dash.get_current_lens()
31
32 self.keyboard.type("playstation")
33- results_category = lens.get_category_by_name("More suggestions")
34+ results_category = lens.get_category_by_name(_("More suggestions"))
35
36 refresh_results_fn = lambda: len(results_category.get_results())
37 self.assertThat(refresh_results_fn, Eventually(GreaterThan(1)))
38@@ -56,7 +58,7 @@
39 lens = self.dash.get_current_lens()
40
41 self.keyboard.type("Text Editor")
42- results_category = lens.get_category_by_name("More suggestions")
43+ results_category = lens.get_category_by_name(_("More suggestions"))
44
45 refresh_results_fn = lambda: len(results_category.get_results())
46 self.assertThat(refresh_results_fn, Eventually(GreaterThan(1)))
47@@ -67,7 +69,7 @@
48 lens = self.dash.get_current_lens()
49
50 self.keyboard.type("megadeth")
51- results_category = lens.get_category_by_name("More suggestions")
52+ results_category = lens.get_category_by_name(_("More suggestions"))
53
54 refresh_results_fn = lambda: len(results_category.get_results())
55 self.assertThat(refresh_results_fn, Eventually(GreaterThan(1)))
56@@ -77,8 +79,8 @@
57 self.dash.ensure_visible()
58 lens = self.dash.get_current_lens()
59
60- self.keyboard.type("a")
61- results_category = lens.get_category_by_name("More suggestions")
62+ self.keyboard.type("playstation")
63+ results_category = lens.get_category_by_name(_("More suggestions"))
64
65 refresh_results_fn = lambda: len(results_category.get_results())
66 self.assertThat(refresh_results_fn, Eventually(GreaterThan(1)))
67@@ -95,8 +97,8 @@
68 self.dash.ensure_visible()
69 lens = self.dash.get_current_lens()
70
71- self.keyboard.type("a")
72- results_category = lens.get_category_by_name("More suggestions")
73+ self.keyboard.type("playstation")
74+ results_category = lens.get_category_by_name(_("More suggestions"))
75
76 refresh_results_fn = lambda: len(results_category.get_results())
77 self.assertThat(refresh_results_fn, Eventually(GreaterThan(2)))