From 3ba2243ba30e814b217abb5102969291a32f1708 Mon Sep 17 00:00:00 2001 From: Christian Adell Date: Thu, 8 Jul 2021 21:07:49 +0200 Subject: [PATCH] Replace self.module by my_module (#75196) While implementing basic Ansible module testing I realised that the `self.module` used in some places is not actually a thing, and I changed to `my_module` to make it work as I understand it was expected. --- docs/docsite/rst/dev_guide/testing_units_modules.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docsite/rst/dev_guide/testing_units_modules.rst b/docs/docsite/rst/dev_guide/testing_units_modules.rst index d9dc6aa41d8..3071e919586 100644 --- a/docs/docsite/rst/dev_guide/testing_units_modules.rst +++ b/docs/docsite/rst/dev_guide/testing_units_modules.rst @@ -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: run_command.return_value = 0, '', '' # successful execution, no output with self.assertRaises(AnsibleExitJson) as result: - self.module.main() + my_module.main() self.assertFalse(result.exception.args[0]['changed']) # Check that run_command has been called 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): with self.assertRaises(AnsibleFailJson): set_module_args({}) - self.module.main() + my_module.main() 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: - self.module.setup_json + my_module.setup_json See also ``test/units/module_utils/aws/test_rds.py``