@ -369,7 +369,7 @@ Here is a simple mock of :meth:`AnsibleModule.run_command` (taken from :file:`te
with patch.object(basic.AnsibleModule, 'run_command') as run_command:
with patch.object(basic.AnsibleModule, 'run_command') as run_command:
run_command.return_value = 0, '', '' # successful execution, no output
run_command.return_value = 0, '', '' # successful execution, no output
with self.assertRaises(AnsibleExitJson) as result:
with self.assertRaises(AnsibleExitJson) as result:
self. module.main()
my_ module.main()
self.assertFalse(result.exception.args[0]['changed'])
self.assertFalse(result.exception.args[0]['changed'])
# Check that run_command has been called
# Check that run_command has been called
run_command.assert_called_once_with('/usr/bin/command args')
run_command.assert_called_once_with('/usr/bin/command args')
@ -443,7 +443,7 @@ mock for :meth:`Ansible.get_bin_path`::
def test_module_fail_when_required_args_missing(self):
def test_module_fail_when_required_args_missing(self):
with self.assertRaises(AnsibleFailJson):
with self.assertRaises(AnsibleFailJson):
set_module_args({})
set_module_args({})
self. module.main()
my_ module.main()
def test_ensure_command_called(self):
def test_ensure_command_called(self):
@ -508,7 +508,7 @@ This now makes it possible to run tests against the module initiation function::
})
})
with self.assertRaises(AnsibleFailJson) as result:
with self.assertRaises(AnsibleFailJson) as result:
self. module.setup_json
my_ module.setup_json
See also `` test/units/module_utils/aws/test_rds.py ``
See also `` test/units/module_utils/aws/test_rds.py ``