summaryrefslogtreecommitdiffstats
path: root/test/units/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'test/units/plugins')
-rw-r--r--test/units/plugins/action/test_action.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/units/plugins/action/test_action.py b/test/units/plugins/action/test_action.py
index 0a50bdd465..d69f28df8a 100644
--- a/test/units/plugins/action/test_action.py
+++ b/test/units/plugins/action/test_action.py
@@ -283,6 +283,9 @@ class TestActionBase(unittest.TestCase):
play_context.become = True
play_context.become_user = 'foo'
+ mock_task.become = True
+ mock_task.become_user = True
+
# our test class
action_base = DerivedActionBase(
task=mock_task,
@@ -654,6 +657,9 @@ class TestActionBase(unittest.TestCase):
mock_task = MagicMock()
mock_task.action = 'copy'
mock_task.args = dict(a=1, b=2, c=3)
+ mock_task.diff = False
+ mock_task.check_mode = False
+ mock_task.no_log = False
# create a mock connection, so we don't actually try and connect to things
def build_module_command(env_string, shebang, cmd, arg_path=None):
@@ -728,6 +734,8 @@ class TestActionBase(unittest.TestCase):
play_context.become = True
play_context.become_user = 'foo'
+ mock_task.become = True
+ mock_task.become_user = True
self.assertEqual(action_base._execute_module(), dict(_ansible_parsed=True, rc=0, stdout="ok", stdout_lines=['ok']))
# test an invalid shebang return
@@ -739,6 +747,7 @@ class TestActionBase(unittest.TestCase):
# test with check mode enabled, once with support for check
# mode and once with support disabled to raise an error
play_context.check_mode = True
+ mock_task.check_mode = True
action_base._configure_module.return_value = ('new', '#!/usr/bin/python', 'this is the module data', 'path')
self.assertEqual(action_base._execute_module(), dict(_ansible_parsed=True, rc=0, stdout="ok", stdout_lines=['ok']))
action_base._supports_check_mode = False
@@ -777,6 +786,7 @@ class TestActionBase(unittest.TestCase):
def test__remote_expand_user_relative_pathing(self):
action_base = _action_base()
action_base._play_context.remote_addr = 'bar'
+ action_base._connection.get_option.return_value = 'bar'
action_base._low_level_execute_command = MagicMock(return_value={'stdout': b'../home/user'})
action_base._connection._shell.join_path.return_value = '../home/user/foo'
with self.assertRaises(AnsibleError) as cm: