diff options
author | Pilou <pierre-louis@libregerbil.fr> | 2017-11-17 18:17:07 +0100 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2017-11-17 09:17:07 -0800 |
commit | a5c9726502a0f15f03da9f8b38141a6de81631ec (patch) | |
tree | 1c8208edc5c53cba018582394a132b2efc7f510b /test/units/modules/network/ios/test_ios_banner.py | |
parent | 71a6dcdf3e528bd088b1399b9dcf3cfb62ae0f36 (diff) | |
download | ansible-a5c9726502a0f15f03da9f8b38141a6de81631ec.tar.gz |
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'
Diffstat (limited to 'test/units/modules/network/ios/test_ios_banner.py')
-rw-r--r-- | test/units/modules/network/ios/test_ios_banner.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/units/modules/network/ios/test_ios_banner.py b/test/units/modules/network/ios/test_ios_banner.py index e464e5f74e..e4bd98109d 100644 --- a/test/units/modules/network/ios/test_ios_banner.py +++ b/test/units/modules/network/ios/test_ios_banner.py @@ -17,11 +17,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import json - from ansible.compat.tests.mock import patch from ansible.modules.network.ios import ios_banner -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 TestIosBannerModule(TestIosModule): @@ -29,6 +28,8 @@ class TestIosBannerModule(TestIosModule): module = ios_banner def setUp(self): + super(TestIosBannerModule, self).setUp() + self.mock_exec_command = patch('ansible.modules.network.ios.ios_banner.exec_command') self.exec_command = self.mock_exec_command.start() @@ -36,6 +37,7 @@ class TestIosBannerModule(TestIosModule): self.load_config = self.mock_load_config.start() def tearDown(self): + super(TestIosBannerModule, self).tearDown() self.mock_exec_command.stop() self.mock_load_config.stop() |