mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Fix unit tests which modify the source tree. (#45763)
* Fix CNOS unit test log usage. * Use temp dir for Galaxy unit tests. * Write to temp files in interfaces_file unit test. * Fix log placement in netapp_e_ldap unit test.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
# (c) 2018, NetApp Inc.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from ansible.modules.storage.netapp.netapp_e_ldap import Ldap
|
||||
from units.modules.utils import ModuleTestCase, set_module_args, AnsibleFailJson, AnsibleExitJson
|
||||
|
||||
@@ -15,11 +19,20 @@ class LdapTest(ModuleTestCase):
|
||||
'api_url': 'http://localhost',
|
||||
'ssid': '1',
|
||||
'state': 'absent',
|
||||
'log_path': './debug.log'
|
||||
|
||||
}
|
||||
REQ_FUNC = 'ansible.modules.storage.netapp.netapp_e_ldap.request'
|
||||
|
||||
def setUp(self):
|
||||
super(LdapTest, self).setUp()
|
||||
|
||||
self.temp_dir = tempfile.mkdtemp('ansible-test_netapp_e_ldap-')
|
||||
self.REQUIRED_PARAMS['log_path'] = os.path.join(self.temp_dir, 'debug.log')
|
||||
|
||||
def tearDown(self):
|
||||
super(LdapTest, self).tearDown()
|
||||
|
||||
shutil.rmtree(self.temp_dir)
|
||||
|
||||
def _make_ldap_instance(self):
|
||||
self._set_args()
|
||||
ldap = Ldap()
|
||||
|
||||
Reference in New Issue
Block a user