@@ -28,13 +28,8 @@ don't break them for those external projects.
2828
2929"""
3030
31−try:
32− from unittest import mock
33−except ImportError:
34− import mock
35−
3631from unity8 import process_helpers
37−from unity8.shell import emulators, fixture_setup, tests
32+from unity8.shell import fixture_setup, tests
3833from unity8.shell.emulators import dash as dash_emulators
3934
4035
@@ -55,35 +50,6 @@ class DashEmulatorTestCase(tests.DashBaseTestCase):
5550 text_field = self.dash._get_search_text_field()
5651 self.assertEqual(text_field.text, 'Test')
5752
58− def test_open_unexisting_scope(self):
59− scope_name = 'unexisting'
60− with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:
61− exception = self.assertRaises(
62− emulators.UnityEmulatorException,
63− self.dash.open_scope, scope_name)
64−
65− self.assertEqual(
66− 'No scope found with id unexisting', str(exception))
67− self.assertFalse(mock_pointer.called)
68−
69− def test_open_already_opened_scope(self):
70− scope_id = self._get_current_scope_id()
71− with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:
72− scope = self.dash.open_scope(scope_id)
73−
74− self.assertFalse(mock_pointer.called)
75− self._assert_scope_is_opened(scope, scope_id)
76−
77− def _assert_scope_is_opened(self, scope, scope_id):
78− self.assertTrue(scope.isCurrent)
79− scope_loader = scope.get_parent()
80− self.assertEqual(scope_loader.scopeId, scope_id)
81−
82− def _get_current_scope_id(self):
83− scope = self.dash.dash_content_list.select_single(
84− 'QQuickLoader', isCurrent=True)
85− return scope.scopeId
86−
8753 def test_open_scope_to_the_right(self):
8854 leftmost_scope = self._get_leftmost_scope_id()
8955 self.dash.open_scope(leftmost_scope)
@@ -92,6 +58,11 @@ class DashEmulatorTestCase(tests.DashBaseTestCase):
9258 scope = self.dash.open_scope(scope_id)
9359 self._assert_scope_is_opened(scope, scope_id)
9460
61+ def _assert_scope_is_opened(self, scope, scope_id):
62+ self.assertTrue(scope.isCurrent)
63+ scope_loader = scope.get_parent()
64+ self.assertEqual(scope_loader.scopeId, scope_id)
65+
9566 def _get_leftmost_scope_id(self):
9667 scope_loaders = self._get_scope_loaders()
9768 leftmost_scope_loader = scope_loaders[0]
@@ -161,15 +132,6 @@ class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
161132 super(DashAppsEmulatorTestCase, self).setUp()
162133 self.applications_scope = self.dash.open_scope('clickscope')
163134
164− def test_get_applications_with_unexisting_category(self):
165− exception = self.assertRaises(
166− emulators.UnityEmulatorException,
167− self.applications_scope.get_applications,
168− 'unexisting category')
169−
170− self.assertEqual(
171− 'No category found with name unexisting category', str(exception))
172−
173135 def test_get_applications_should_return_correct_applications(self):
174136 category = '2'
175137 category_element = self.applications_scope._get_category_element(
@@ -181,9 +143,10 @@ class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
181143 :expected_apps_count]
182144 x_center = list_view.globalRect.x + list_view.width / 2
183145 y_center = list_view.globalRect.y + list_view.height / 2
184− y_diff = category_element.y - list_view.height + category_element.height
185− list_view._slow_drag(x_center, x_center,
186− y_center, y_center - y_diff)
146+ y_diff = (
147+ category_element.y - list_view.height + category_element.height
148+ )
149+ list_view._slow_drag(x_center, x_center, y_center, y_center - y_diff)
187150 applications = self.applications_scope.get_applications(category)
188151 self.assertEqual(expected_applications, applications)
189152