mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-30 12:59:09 -07:00
Unit tests: make set_module_args() a context manager, and remove copies of it in some tests (#9838)
Make set_module_args() a context manager, and remove copies of set_module_args(). Prepares for Data Tagging.
This commit is contained in:
parent
402f725424
commit
a1781d09dd
84 changed files with 4043 additions and 4302 deletions
|
@ -34,18 +34,17 @@ class IPAKeytabModuleTestCase(ModuleTestCase):
|
|||
return exc.exception.args[0]
|
||||
|
||||
def test_present(self):
|
||||
set_module_args({
|
||||
with set_module_args({
|
||||
'path': '/tmp/test.keytab',
|
||||
'principal': 'HTTP/freeipa-dc02.ipa.test',
|
||||
'ipa_host': 'freeipa-dc01.ipa.test',
|
||||
'state': 'present'
|
||||
})
|
||||
}):
|
||||
self.module_main_command.side_effect = [
|
||||
(0, '{}', ''),
|
||||
]
|
||||
|
||||
self.module_main_command.side_effect = [
|
||||
(0, '{}', ''),
|
||||
]
|
||||
|
||||
result = self.module_main(AnsibleExitJson)
|
||||
result = self.module_main(AnsibleExitJson)
|
||||
|
||||
self.assertTrue(result['changed'])
|
||||
self.module_main_command.assert_has_calls([
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue