mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00: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:
@@ -22,7 +22,8 @@ __metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.ios import ios_ping
|
||||
from .ios_module import TestIosModule, load_fixture, set_module_args
|
||||
from units.modules.utils import set_module_args
|
||||
from .ios_module import TestIosModule, load_fixture
|
||||
|
||||
|
||||
class TestIosPingModule(TestIosModule):
|
||||
@@ -30,10 +31,12 @@ class TestIosPingModule(TestIosModule):
|
||||
module = ios_ping
|
||||
|
||||
def setUp(self):
|
||||
super(TestIosPingModule, self).setUp()
|
||||
self.mock_run_commands = patch('ansible.modules.network.ios.ios_ping.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestIosPingModule, self).tearDown()
|
||||
self.mock_run_commands.stop()
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
|
||||
Reference in New Issue
Block a user