]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/run-tox-mgr-dashboard: Do not write to /tmp/test_sanitize_password.txt file 44728/head
authorKevin Zhao <kevin.zhao@linaro.org>
Thu, 22 Jul 2021 06:58:20 +0000 (07:58 +0100)
committerCory Snyder <csnyder@iland.com>
Fri, 21 Jan 2022 18:12:14 +0000 (13:12 -0500)
To allow running multiple instances of the same tests.

Fixes: https://tracker.ceph.com/issues/51792
Signed-off-by: Kevin Zhao <kevin.zhao@linaro.org>
(cherry picked from commit d04ef800abd671a564795eba198ca976619b4cc7)

src/pybind/mgr/dashboard/tests/test_access_control.py

index c362d7b9b413f50869bc2c229d819f1c6f4f9789..b1caa34a921bc12b0ad8d40072ccffa00fd64712 100644 (file)
@@ -4,6 +4,7 @@ from __future__ import absolute_import
 
 import errno
 import json
+import tempfile
 import time
 import unittest
 
@@ -588,7 +589,7 @@ class AccessControlTest(unittest.TestCase, CLICommandTestMixin):
     def test_sanitize_password(self):
         self.test_create_user()
         password = 'myPass\\n\\r\\n'
-        with open('/tmp/test_sanitize_password.txt', 'w+') as pwd_file:
+        with tempfile.TemporaryFile(mode='w+') as pwd_file:
             # Add new line separators (like some text editors when a file is saved).
             pwd_file.write('{}{}'.format(password, '\n\r\n\n'))
             pwd_file.seek(0)