@@ -21,19 +21,16 @@ from testscenarios import multiply_scenarios
21from unity8 import (
21from unity8 import (
22 fixture_setup,
22 fixture_setup,
23 indicators,
23 indicators,
26−from unity8.shell import tests
27from unity8.indicators import tests
25from unity8.indicators import tests
29from autopilot.matchers import Eventually
27from autopilot.matchers import Eventually
30from testtools.matchers import Equals, NotEquals
28from testtools.matchers import Equals, NotEquals
34class TestIndicatorBaseTestCase(tests.IndicatorTestCase):
31class TestIndicatorBaseTestCase(tests.IndicatorTestCase):
36− scenarios = [ tests.IndicatorTestCase.device_emulation_scenarios[0] ]
33+ scenarios = [tests.IndicatorTestCase.device_emulation_scenarios[0]]
38 def setUp(self):
35 def setUp(self):
39 super(TestIndicatorBaseTestCase, self).setUp()
36 super(TestIndicatorBaseTestCase, self).setUp()
@@ -49,7 +46,8 @@ class TestIndicatorBaseTestCase(tests.IndicatorTestCase):
49 self.indicator_page = self.indicator.open()
46 self.indicator_page = self.indicator.open()
51 def launch_indicator_service(self):
48 def launch_indicator_service(self):
49+ launch_service_fixture = \
52− launch_service_fixture = fixture_setup.LaunchMockIndicatorService(self.action_delay)
50+ fixture_setup.LaunchMockIndicatorService(self.action_delay)
53 self.useFixture(launch_service_fixture)
51 self.useFixture(launch_service_fixture)
@@ -95,6 +93,7 @@ class TestServerValueUpdate(TestIndicatorBaseTestCase):
95 Eventually(Equals(slider.value), timeout=20)
93 Eventually(Equals(slider.value), timeout=20)
98class TestBuffering(TestIndicatorBaseTestCase):
97class TestBuffering(TestIndicatorBaseTestCase):
100 """Test that switching multiple times will buffer activations
99 """Test that switching multiple times will buffer activations
@@ -107,11 +106,11 @@ class TestBuffering(TestIndicatorBaseTestCase):
108 switch = self.indicator_page.get_switcher()
107 switch = self.indicator_page.get_switcher()
109 switch.change_state()
108 switch.change_state()
110− intermediate_value = switch.checked;
109+ intermediate_value = switch.checked
112 # will buffer change until it receives the change from server
111 # will buffer change until it receives the change from server
113 switch.change_state()
112 switch.change_state()
114− final_value = switch.checked;
113+ final_value = switch.checked
116 # backend will respond to first switch.
115 # backend will respond to first switch.
117 switch_menu = self.indicator_page.get_switch_menu()
116 switch_menu = self.indicator_page.get_switch_menu()
@@ -121,7 +120,8 @@ class TestBuffering(TestIndicatorBaseTestCase):
122 # The buffered activation should have gone to server now.
121 # The buffered activation should have gone to server now.
124− # front-end should not change as a result of server update while it is buffered
123+ # front-end should not change as a result of server update
124+ # while it is buffered
125 self.assertThat(
125 self.assertThat(
126 switch.checked,
126 switch.checked,
127 Equals(final_value)
127 Equals(final_value)
@@ -142,15 +142,15 @@ class TestBuffering(TestIndicatorBaseTestCase):
142 def test_slider_buffers_activations(self):
142 def test_slider_buffers_activations(self):
144 slider = self.indicator_page.get_slider()
144 slider = self.indicator_page.get_slider()
145− original_value = slider.value;
145+ original_value = slider.value
146 slider.slide_left()
146 slider.slide_left()
148 # will buffer change until it receives the change from server
148 # will buffer change until it receives the change from server
149 slider.slide_right()
149 slider.slide_right()
150− final_value = slider.value;
150+ final_value = slider.value
152− # backend will respond to first slider. Since it's a live slider it'll probably
152+ # backend will respond to first slider. Since it's a live slider
153− # be a random value along the slide.
153+ # it'll probably be a random value along the slide.
154 slider_menu = self.indicator_page.get_slider_menu()
154 slider_menu = self.indicator_page.get_slider_menu()
155 self.assertThat(
155 self.assertThat(
156 slider_menu.serverValue,
156 slider_menu.serverValue,
@@ -163,7 +163,8 @@ class TestBuffering(TestIndicatorBaseTestCase):
163 NotEquals(final_value)
163 NotEquals(final_value)
166− # front-end should not change as a result of server update while it is buffered
166+ # front-end should not change as a result of server update
167+ # while it is buffered
167 self.assertThat(
168 self.assertThat(
168 slider.value,
169 slider.value,
169 Equals(final_value)
170 Equals(final_value)
@@ -189,17 +190,18 @@ class TestClientRevertsToServerValue(TestIndicatorBaseTestCase):
190 See https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1390136 .
191 See https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1390136 .
192− action_delay = -1 # never action.
193+ action_delay = -1 # never action.
194 def test_switch_reverts_on_late_response(self):
195 def test_switch_reverts_on_late_response(self):
196 switch = self.indicator_page.get_switcher()
197 switch = self.indicator_page.get_switcher()
197 switch_menu = self.indicator_page.get_switch_menu()
198 switch_menu = self.indicator_page.get_switch_menu()
199− original_value = switch.checked;
200+ original_value = switch.checked
200 switch.change_state()
201 switch.change_state()
202− # switch should revert to original value after 5 seconds (30 seconds in real usage)
203+ # switch should revert to original value after 5 seconds
204+ # (30 seconds in real usage)
203 self.assertThat(
205 self.assertThat(
204 switch.checked,
206 switch.checked,
205 Eventually(Equals(original_value), timeout=20)
207 Eventually(Equals(original_value), timeout=20)
@@ -216,10 +218,11 @@ class TestClientRevertsToServerValue(TestIndicatorBaseTestCase):
216 slider = self.indicator_page.get_slider()
218 slider = self.indicator_page.get_slider()
217 slider_menu = self.indicator_page.get_slider_menu()
219 slider_menu = self.indicator_page.get_slider_menu()
219− original_value = slider.value;
221+ original_value = slider.value
220 slider.slide_left()
222 slider.slide_left()
222− # slider should revert to original value after 5 seconds (30 seconds in real usage)
224+ # slider should revert to original value after 5 seconds
225+ # (30 seconds in real usage)
223 self.assertThat(
226 self.assertThat(
224 slider.value,
227 slider.value,
225 Eventually(Equals(original_value), timeout=20)
228 Eventually(Equals(original_value), timeout=20)