mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 12:33:59 -07:00
[PR #7247/6e3a56ff backport][stable-7] encapsulate test function in the helper class (#7255)
encapsulate test function in the helper class (#7247)
(cherry picked from commit 6e3a56ffce
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
5b9b98340b
commit
ffca7eaf52
9 changed files with 45 additions and 139 deletions
|
@ -6,24 +6,10 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import xfconf_info
|
||||
from .helper import CmdRunnerTestHelper
|
||||
from .helper import Helper
|
||||
|
||||
|
||||
helper = CmdRunnerTestHelper.from_file(xfconf_info.main, "tests/unit/plugins/modules/test_xfconf_info.yaml")
|
||||
helper = Helper.from_file(xfconf_info.main, "tests/unit/plugins/modules/test_xfconf_info.yaml")
|
||||
patch_bin = helper.cmd_fixture
|
||||
|
||||
|
||||
@pytest.mark.parametrize('patch_ansible_module, testcase',
|
||||
helper.testcases_params, ids=helper.testcases_ids,
|
||||
indirect=['patch_ansible_module'])
|
||||
@pytest.mark.usefixtures('patch_ansible_module')
|
||||
def test_module(mocker, capfd, patch_bin, testcase):
|
||||
"""
|
||||
Run unit tests for test cases listed in TEST_CASES
|
||||
"""
|
||||
|
||||
with helper(testcase, mocker, capfd) as testcase_context:
|
||||
testcase_context.run()
|
||||
test_module = helper.test_module
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue