Skip to content

Commit

Permalink
Fixing tests with async variable
Browse files Browse the repository at this point in the history
  • Loading branch information
lexadler committed Sep 11, 2019
1 parent f981df6 commit c4f299b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/pytractor/tests/unit/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def setUp(self):
self.mock_root_element)

@patch('pytractor.mixins.resource_string')
def verify__execute_client_script_call(self, async, mock_resource_string):
def verify__execute_client_script_call(self, is_async, mock_resource_string):
with patch.multiple(
self.instance,
execute_async_script=DEFAULT, execute_script=DEFAULT,
Expand All @@ -121,15 +121,15 @@ def verify__execute_client_script_call(self, async, mock_resource_string):
'execute_async_script')]
mock_arg = MagicMock()
result = self.instance._execute_client_script('SCRIPT', mock_arg,
async=async)
is_async=is_async)
# the script was read correctly with resource_string()
mock_resource_string.assert_called_once_with(
'pytractor.mixins',
'{}/{}.js'.format(CLIENT_SCRIPTS_DIR, 'SCRIPT')
)
# execute_async_script or execute_script were called (but not both)
script_content = mock_resource_string.return_value.decode()
if async:
if is_async:
mock_execute_async_script.assert_called_once_with(script_content,
mock_arg)
self.assertEqual(len(mock_execute_script.mock_calls), 0)
Expand Down Expand Up @@ -164,7 +164,7 @@ def verify_function_executes_script_with(self, func_to_call,
def test_wait_for_angular(self):
self.verify_function_executes_script_with(
self.instance.wait_for_angular,
'waitForAngular', self.mock_root_element, async=True
'waitForAngular', self.mock_root_element, is_async=True
)

def test_wait_for_angular_does_not_call_script_if_ignore_synchronization(
Expand Down Expand Up @@ -274,7 +274,7 @@ def test_find_elements_by_binding(self):
mock_using)
mock_methods['wait_for_angular'].assert_called_once_with()
mock_methods['_execute_client_script'].assert_called_once_with(
'findBindings', mock_descriptor, False, mock_using, async=False
'findBindings', mock_descriptor, False, mock_using, is_async=False
)
self.assertIs(result,
mock_methods['_execute_client_script'].return_value)
Expand Down Expand Up @@ -439,7 +439,7 @@ def test_find_elements_by_exact_binding_calls_protractor_script(self):

mock_methods['wait_for_angular'].assert_called_once_with()
mock_methods['_execute_client_script'].assert_called_once_with(
'findBindings', mock_descriptor, True, mock_using, async=False
'findBindings', mock_descriptor, True, mock_using, is_async=False
)
self.assertIs(result,
mock_methods['_execute_client_script'].return_value)
Expand Down Expand Up @@ -486,7 +486,7 @@ def test_find_elements_by_model_calls_protractor_script(self):

mock_methods['wait_for_angular'].assert_called_once_with()
mock_methods['_execute_client_script'].assert_called_once_with(
'findByModel', mock_descriptor, mock_using, async=False
'findByModel', mock_descriptor, mock_using, is_async=False
)
self.assertIs(result,
mock_methods['_execute_client_script'].return_value)
Expand Down Expand Up @@ -514,7 +514,7 @@ def test_location_abs_url_calls_protractor_script(self):

mock_methods['wait_for_angular'].assert_called_once_with()
mock_methods['_execute_client_script'].assert_called_once_with(
'getLocationAbsUrl', self.instance._root_element, async=False
'getLocationAbsUrl', self.instance._root_element, is_async=False
)
self.assertIs(result,
mock_methods['_execute_client_script'].return_value)
Expand All @@ -529,7 +529,7 @@ def test_set_location_calls_protractor_script(self):

mock_methods['wait_for_angular'].assert_called_once_with()
mock_methods['_execute_client_script'].assert_called_once_with(
'setLocation', self.instance._root_element, url, async=False
'setLocation', self.instance._root_element, url, is_async=False
)
self.assertIs(result,
mock_methods['_execute_client_script'].return_value)

0 comments on commit c4f299b

Please sign in to comment.