Add a test for issue 40578

This commit is contained in:
Erik Johnson 2018-01-29 17:10:10 -06:00
parent 3331aeafdd
commit 0d92e0a868
No known key found for this signature in database
GPG Key ID: 5E5583C437808F3F
3 changed files with 22 additions and 2 deletions

View File

@ -0,0 +1 @@

View File

@ -1170,6 +1170,27 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
finally:
shutil.rmtree(name, ignore_errors=True)
def test_recurse_issue_40578(self):
'''
This ensures that the state doesn't raise an exception when it
encounters a file with a unicode filename in the process of invoking
file.source_list.
'''
issue_dir = 'issue-40578'
name = os.path.join(TMP, issue_dir)
try:
ret = self.run_state('file.recurse',
name=name,
source='salt://соль')
self.assertSaltTrueReturn(ret)
self.assertEqual(
sorted(salt.utils.data.decode(os.listdir(name))),
sorted(['foo.txt', 'спам.txt', 'яйца.txt'])
)
finally:
shutil.rmtree(name, ignore_errors=True)
def test_replace(self):
'''
file.replace
@ -2214,8 +2235,6 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
'+마지막 행\n'
)
diff = salt.utils.stringutils.to_str(diff)
# using unicode.encode('utf-8') we should get the same as
# an utf-8 string
# future_lint: disable=blacklisted-function
expected = {
str('file_|-some-utf8-file-create_|-{0}_|-managed').format(test_file_encoded): {