mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Resolve test failures
This commit is contained in:
parent
a4d2238e50
commit
3466e73c50
1 changed files with 7 additions and 7 deletions
|
@ -217,7 +217,7 @@ class TestActionBase(unittest.TestCase):
|
||||||
with patch.object(os, 'rename') as m:
|
with patch.object(os, 'rename') as m:
|
||||||
mock_task.args = dict(a=1, foo='fö〩')
|
mock_task.args = dict(a=1, foo='fö〩')
|
||||||
mock_connection.module_implementation_preferences = ('',)
|
mock_connection.module_implementation_preferences = ('',)
|
||||||
(style, shebang, data) = action_base._configure_module(mock_task.action, mock_task.args)
|
(style, shebang, data, module_path, is_binary) = action_base._configure_module(mock_task.action, mock_task.args)
|
||||||
self.assertEqual(style, "new")
|
self.assertEqual(style, "new")
|
||||||
self.assertEqual(shebang, b"#!/usr/bin/python")
|
self.assertEqual(shebang, b"#!/usr/bin/python")
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class TestActionBase(unittest.TestCase):
|
||||||
mock_task.action = 'win_copy'
|
mock_task.action = 'win_copy'
|
||||||
mock_task.args = dict(b=2)
|
mock_task.args = dict(b=2)
|
||||||
mock_connection.module_implementation_preferences = ('.ps1',)
|
mock_connection.module_implementation_preferences = ('.ps1',)
|
||||||
(style, shebang, data) = action_base._configure_module('stat', mock_task.args)
|
(style, shebang, data, module_path, is_binary) = action_base._configure_module('stat', mock_task.args)
|
||||||
self.assertEqual(style, "new")
|
self.assertEqual(style, "new")
|
||||||
self.assertEqual(shebang, None)
|
self.assertEqual(shebang, None)
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ class TestActionBase(unittest.TestCase):
|
||||||
action_base._low_level_execute_command = MagicMock()
|
action_base._low_level_execute_command = MagicMock()
|
||||||
action_base._fixup_perms = MagicMock()
|
action_base._fixup_perms = MagicMock()
|
||||||
|
|
||||||
action_base._configure_module.return_value = ('new', '#!/usr/bin/python', 'this is the module data')
|
action_base._configure_module.return_value = ('new', '#!/usr/bin/python', 'this is the module data', None, False)
|
||||||
action_base._late_needs_tmp_path.return_value = False
|
action_base._late_needs_tmp_path.return_value = False
|
||||||
action_base._compute_environment_string.return_value = ''
|
action_base._compute_environment_string.return_value = ''
|
||||||
action_base._connection.has_pipelining = True
|
action_base._connection.has_pipelining = True
|
||||||
|
@ -581,12 +581,12 @@ class TestActionBase(unittest.TestCase):
|
||||||
self.assertEqual(action_base._execute_module(module_name='foo', module_args=dict(z=9, y=8, x=7), task_vars=dict(a=1)), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
self.assertEqual(action_base._execute_module(module_name='foo', module_args=dict(z=9, y=8, x=7), task_vars=dict(a=1)), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
||||||
|
|
||||||
# test with needing/removing a remote tmp path
|
# test with needing/removing a remote tmp path
|
||||||
action_base._configure_module.return_value = ('old', '#!/usr/bin/python', 'this is the module data')
|
action_base._configure_module.return_value = ('old', '#!/usr/bin/python', 'this is the module data', None, False)
|
||||||
action_base._late_needs_tmp_path.return_value = True
|
action_base._late_needs_tmp_path.return_value = True
|
||||||
action_base._make_tmp_path.return_value = '/the/tmp/path'
|
action_base._make_tmp_path.return_value = '/the/tmp/path'
|
||||||
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
||||||
|
|
||||||
action_base._configure_module.return_value = ('non_native_want_json', '#!/usr/bin/python', 'this is the module data')
|
action_base._configure_module.return_value = ('non_native_want_json', '#!/usr/bin/python', 'this is the module data', None, False)
|
||||||
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
||||||
|
|
||||||
play_context.become = True
|
play_context.become = True
|
||||||
|
@ -594,14 +594,14 @@ class TestActionBase(unittest.TestCase):
|
||||||
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
||||||
|
|
||||||
# test an invalid shebang return
|
# test an invalid shebang return
|
||||||
action_base._configure_module.return_value = ('new', '', 'this is the module data')
|
action_base._configure_module.return_value = ('new', '', 'this is the module data', None, False)
|
||||||
action_base._late_needs_tmp_path.return_value = False
|
action_base._late_needs_tmp_path.return_value = False
|
||||||
self.assertRaises(AnsibleError, action_base._execute_module)
|
self.assertRaises(AnsibleError, action_base._execute_module)
|
||||||
|
|
||||||
# test with check mode enabled, once with support for check
|
# test with check mode enabled, once with support for check
|
||||||
# mode and once with support disabled to raise an error
|
# mode and once with support disabled to raise an error
|
||||||
play_context.check_mode = True
|
play_context.check_mode = True
|
||||||
action_base._configure_module.return_value = ('new', '#!/usr/bin/python', 'this is the module data')
|
action_base._configure_module.return_value = ('new', '#!/usr/bin/python', 'this is the module data', None, False)
|
||||||
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
self.assertEqual(action_base._execute_module(), dict(rc=0, stdout="ok", stdout_lines=['ok']))
|
||||||
action_base._supports_check_mode = False
|
action_base._supports_check_mode = False
|
||||||
self.assertRaises(AnsibleError, action_base._execute_module)
|
self.assertRaises(AnsibleError, action_base._execute_module)
|
||||||
|
|
Loading…
Add table
Reference in a new issue