mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-02 16:32:56 +00:00
[PR #9666/c0f57b5c backport][stable-10] test helper: add support for check and diff modes (#9669)
test helper: add support for check and diff modes (#9666)
(cherry picked from commit c0f57b5c62)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
4d4e626f95
commit
c35f13084d
2 changed files with 47 additions and 7 deletions
|
|
@ -72,7 +72,13 @@ class Helper(object):
|
|||
"""
|
||||
Run unit tests for each test case in self.test_cases
|
||||
"""
|
||||
patch_ansible_module(test_case.input)
|
||||
args = {}
|
||||
args.update(test_case.input)
|
||||
if test_case.flags.get("check"):
|
||||
args["_ansible_check_mode"] = test_case.flags.get("check")
|
||||
if test_case.flags.get("diff"):
|
||||
args["_ansible_diff"] = test_case.flags.get("diff")
|
||||
patch_ansible_module(args)
|
||||
self.runner.run(mocker, capfd, test_case)
|
||||
|
||||
self.add_func_to_test_module("test_module", _test_module)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue