diff --git a/plugins/modules/ibridges_sync.py b/plugins/modules/ibridges_sync.py index 70e754e..7ecf599 100644 --- a/plugins/modules/ibridges_sync.py +++ b/plugins/modules/ibridges_sync.py @@ -140,7 +140,7 @@ def run_module(): target = locations[0] else: module.fail_json(msg='Unsupported sync mode "{mode}", choose either "up" or "down".'.format(mode=module.params['mode']), changed=False) - + from contextlib import redirect_stdout from io import StringIO ibridges_stdout = StringIO() diff --git a/tests/unit/plugins/modules/test_ibridges_sync.py b/tests/unit/plugins/modules/test_ibridges_sync.py index 1a2ac7f..dba189a 100644 --- a/tests/unit/plugins/modules/test_ibridges_sync.py +++ b/tests/unit/plugins/modules/test_ibridges_sync.py @@ -2,7 +2,7 @@ import unittest import copy -from unittest.mock import patch, Mock +from unittest.mock import patch from ansible.module_utils import basic from ansible.module_utils.common.text.converters import to_bytes from plugins.modules import ibridges_sync @@ -88,7 +88,7 @@ def test_sync_down(self, mocked_session, mocked_sync): with self.assertRaises(AnsibleExitJson) as context: ibridges_sync.main() - + expectation = { 'changed': True, 'msg': '', @@ -126,7 +126,7 @@ def test_sync_up(self, mocked_session, mocked_sync): with self.assertRaises(AnsibleExitJson) as context: ibridges_sync.main() - + expectation = { 'changed': False, 'msg': '', @@ -157,7 +157,7 @@ def test_sync_dry_run(self, mocked_session, mocked_sync): with self.assertRaises(AnsibleExitJson) as context: ibridges_sync.main() - + expectation = { 'changed': False, 'msg': 'Executed iBridges dry run.',