Fix unit.utils.test_utils for Windows

Use os agnostic path seps
Mock sys.platform to not return win
This commit is contained in:
twangboy 2017-10-05 16:47:32 -06:00
parent 1a718eb1ed
commit 254dac7723
No known key found for this signature in database
GPG Key ID: 93FF3BDEB278C9EB

View File

@ -99,7 +99,7 @@ class UtilsTestCase(TestCase):
def test_path_join(self):
with patch('salt.utils.is_windows', return_value=False) as is_windows_mock:
self.assertFalse(is_windows_mock.return_value)
expected_path = '/a/b/c/d'
expected_path = os.path.join(os.sep + 'a', 'b', 'c', 'd')
ret = utils.path_join('/a/b/c', 'd')
self.assertEqual(ret, expected_path)
@ -985,7 +985,8 @@ class UtilsTestCase(TestCase):
ret = utils.daemonize_if({})
self.assertEqual(None, ret)
with patch('salt.utils.daemonize'):
with patch('salt.utils.daemonize'), \
patch('sys.platform', 'not windows'):
utils.daemonize_if({})
self.assertTrue(utils.daemonize.called)
# pylint: enable=assignment-from-none