1
0
mirror of https://github.com/ansible-collections/community.general.git synced 2025-07-29 07:41:16 +03:00

encapsulate test function in the helper class (#7247)

This commit is contained in:
Alexei Znamensky
2023-09-13 00:24:10 +12:00
committed by GitHub
parent bdf8852e8d
commit 6e3a56ffce
9 changed files with 45 additions and 139 deletions

View File

@ -7,24 +7,10 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible_collections.community.general.plugins.modules import gconftool2
from .helper import CmdRunnerTestHelper
from .helper import Helper
helper = CmdRunnerTestHelper.from_file(gconftool2.main, "tests/unit/plugins/modules/test_gconftool2.yaml")
helper = Helper.from_file(gconftool2.main, "tests/unit/plugins/modules/test_gconftool2.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