mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-11 03:31:29 -07: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:
parent
71a6dcdf3e
commit
a5c9726502
154 changed files with 671 additions and 1113 deletions
|
@ -22,7 +22,8 @@ __metaclass__ = type
|
|||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.junos import junos_config
|
||||
from .junos_module import TestJunosModule, load_fixture, set_module_args
|
||||
from units.modules.utils import set_module_args
|
||||
from .junos_module import TestJunosModule, load_fixture
|
||||
|
||||
|
||||
class TestJunosConfigModule(TestJunosModule):
|
||||
|
@ -30,6 +31,8 @@ class TestJunosConfigModule(TestJunosModule):
|
|||
module = junos_config
|
||||
|
||||
def setUp(self):
|
||||
super(TestJunosConfigModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible.modules.network.junos.junos_config.get_configuration')
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
|
@ -55,6 +58,7 @@ class TestJunosConfigModule(TestJunosModule):
|
|||
self.send_request = self.mock_send_request.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestJunosConfigModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
self.mock_lock_configuration.stop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue