Merge pull request #49180 from dwoz/test_fixes

Cherry-pick test fixes
This commit is contained in:
Daniel Wozniak 2018-08-17 21:08:16 -07:00 committed by GitHub
commit 6d57ac1083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 10 deletions

View File

@ -2987,7 +2987,7 @@ def directory(name,
perms: full_control
- win_inheritance: False
'''
name = os.path.expanduser(name)
name = os.path.normcase(os.path.expanduser(name))
ret = {'name': name,
'changes': {},
'pchanges': {},
@ -3515,7 +3515,7 @@ def recurse(name,
# "env" is not supported; Use "saltenv".
kwargs.pop('env')
name = os.path.expanduser(sdecode(name))
name = os.path.normcase(os.path.expanduser(sdecode(name)))
user = _test_owner(kwargs, user=user)
if salt.utils.platform.is_windows():

View File

@ -267,7 +267,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
if IS_WINDOWS:
expected = 'The \'mode\' option is not supported on Windows'
self.assertEqual(ret[ret.keys()[0]]['comment'], expected)
self.assertEqual(ret[list(ret)[0]]['comment'], expected)
self.assertSaltFalseReturn(ret)
return
@ -303,7 +303,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
if IS_WINDOWS:
expected = 'The \'mode\' option is not supported on Windows'
self.assertEqual(ret[ret.keys()[0]]['comment'], expected)
self.assertEqual(ret[list(ret)[0]]['comment'], expected)
self.assertSaltFalseReturn(ret)
return
@ -335,7 +335,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
if IS_WINDOWS:
expected = 'The \'mode\' option is not supported on Windows'
self.assertEqual(ret[ret.keys()[0]]['comment'], expected)
self.assertEqual(ret[list(ret)[0]]['comment'], expected)
self.assertSaltFalseReturn(ret)
return
@ -418,7 +418,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
)
if IS_WINDOWS:
expected = 'The \'mode\' option is not supported on Windows'
self.assertEqual(ret[ret.keys()[0]]['comment'], expected)
self.assertEqual(ret[list(ret)[0]]['comment'], expected)
self.assertSaltFalseReturn(ret)
return

View File

@ -767,6 +767,8 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
name = '/etc/testdir'
user = 'salt'
group = 'saltstack'
if salt.utils.platform.is_windows():
name = name.replace('/', '\\')
ret = {'name': name,
'result': False,
@ -863,7 +865,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
else:
comt = ('The following files will be changed:\n{0}:'
' directory - new\n'.format(name))
p_chg = {'/etc/testdir': {'directory': 'new'}}
p_chg = {name: {'directory': 'new'}}
ret.update({
'comment': comt,
'result': None,
@ -920,6 +922,8 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
source = 'salt://code/flask'
user = 'salt'
group = 'saltstack'
if salt.utils.platform.is_windows():
name = name.replace('/', '\\')
ret = {'name': name,
'result': False,

View File

@ -4,21 +4,21 @@ integration.grains.test_core
integration.loader.test_ext_grains
integration.loader.test_ext_modules
integration.modules.test_aliases
integration.modules.test_autoruns
integration.modules.win_test_autoruns
integration.modules.test_beacons
integration.modules.test_config
integration.modules.test_cp
integration.modules.test_cmdmod
integration.modules.test_data
integration.modules.test_disk
integration.modules.test_firewall
integration.modules.test_win_firewall
integration.modules.test_git
integration.modules.test_grains
integration.modules.test_groupadd
integration.modules.test_hosts
integration.modules.test_mine
integration.modules.test_network
integration.modules.test_ntp
integration.modules.test_win_ntp
integration.modules.test_pillar
integration.modules.test_pip
integration.modules.test_pkg