mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 15:21:25 -07:00
Unit tests: share common code (#31456)
* move set_module_args to units.modules.utils * unit tests: reuse set_module_args * unit tests: mock exit/fail_json in module.utils.ModuleTestCase * unit tests: use module.utils.ModuleTestCase * unit tests: fix 'import shadowed by loop variable'
This commit is contained in:
parent
71a6dcdf3e
commit
a5c9726502
154 changed files with 671 additions and 1113 deletions
|
@ -6,15 +6,12 @@ from ansible.module_utils import basic
|
|||
|
||||
from ansible.modules.packaging.language import pip
|
||||
|
||||
from ..utils import (set_module_args, AnsibleFailJson, exit_json, fail_json)
|
||||
from units.modules.utils import set_module_args, AnsibleFailJson, ModuleTestCase
|
||||
|
||||
|
||||
class TestPip(unittest.TestCase):
|
||||
|
||||
class TestPip(ModuleTestCase):
|
||||
def setUp(self):
|
||||
self.mock_ansible_module = patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
|
||||
self.mock_ansible_module.start()
|
||||
self.addCleanup(self.mock_ansible_module.stop)
|
||||
super(TestPip, self).setUp()
|
||||
|
||||
@patch.object(basic.AnsibleModule, 'get_bin_path')
|
||||
def test_failure_when_pip_absent(self, mock_get_bin_path):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue