Fix runner returns test on Windows

This commit is contained in:
Daniel A Wozniak 2018-09-15 21:10:53 +00:00 committed by Daniel A. Wozniak
parent f908cde7f7
commit 2340a5875f
No known key found for this signature in database
GPG key ID: 166B9D2C06C82D61

View file

@ -6,6 +6,7 @@ Tests for runner_returns
from __future__ import absolute_import, print_function, unicode_literals
import errno
import os
import socket
import tempfile
# Import Salt Testing libs
@ -41,14 +42,14 @@ class RunnerReturnsTest(ShellCase):
mode='w',
suffix='.conf',
dir=self.master_d_dir,
delete=True,
delete=False,
)
def tearDown(self):
'''
Close the tempfile.NamedTemporaryFile object, cleaning it up
'''
self.conf.close()
salt.utils.files.rm_rf(self.master_d_dir)
# Force a reload of the configuration now that our temp config file has
# been removed.
self.run_run_plus('test.arg', __reload_config=True)
@ -75,6 +76,7 @@ class RunnerReturnsTest(ShellCase):
'''
self.conf.write(salt.utils.yaml.safe_dump(data, default_flow_style=False))
self.conf.flush()
self.conf.close()
def test_runner_returns_disabled(self):
'''
@ -129,6 +131,8 @@ class RunnerReturnsTest(ShellCase):
user = 'sudo_{0}'.format(os.environ['SUDO_USER'])
else:
user = RUNTIME_VARS.RUNNING_TESTS_USER
if salt.utils.platform.is_windows():
user = 'sudo_{0}\\{1}'.format(socket.gethostname(), user)
self.assertEqual(
deserialized,
{'return': {'fun': 'runner.test.arg',