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:
@@ -19,11 +19,10 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.eos import eos_system
|
||||
from .eos_module import TestEosModule, load_fixture, set_module_args
|
||||
from units.modules.utils import set_module_args
|
||||
from .eos_module import TestEosModule, load_fixture
|
||||
|
||||
|
||||
class TestEosSystemModule(TestEosModule):
|
||||
@@ -31,6 +30,8 @@ class TestEosSystemModule(TestEosModule):
|
||||
module = eos_system
|
||||
|
||||
def setUp(self):
|
||||
super(TestEosSystemModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible.modules.network.eos.eos_system.get_config')
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
@@ -38,6 +39,8 @@ class TestEosSystemModule(TestEosModule):
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestEosSystemModule, self).tearDown()
|
||||
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user