mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
file state test fixes
- fix integration.states.test_file.FileTest.test_managed_latin1_diff - fix integration.states.test_file.FileTest.test_recurse_issue_40578 - fix some issues integration.states.test_file.FileTest.test_issue_8947_utf8_sls, this test still fails due to py2 popen's unicode handling.
This commit is contained in:
parent
74b78835b3
commit
7650208dbc
1 changed files with 9 additions and 6 deletions
|
@ -740,7 +740,7 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
source='salt://issue-48777/new.html')
|
||||
ret = ret[next(iter(ret))]
|
||||
assert ret['result'] is True, ret
|
||||
diff_lines = ret['changes']['diff'].split('\n')
|
||||
diff_lines = ret['changes']['diff'].split(os.linesep)
|
||||
assert '+räksmörgås' in diff_lines, diff_lines
|
||||
|
||||
def test_directory(self):
|
||||
|
@ -1272,11 +1272,14 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
name=name,
|
||||
source='salt://соль')
|
||||
self.assertSaltTrueReturn(ret)
|
||||
# Providing unicode to os.listdir so that we avoid having listdir try
|
||||
# to decode the filenames using the systemencoding on windows.
|
||||
self.assertEqual(
|
||||
sorted(salt.utils.data.decode(os.listdir(name), normalize=True)),
|
||||
sorted(os.listdir(name.decode('utf-8'))),
|
||||
sorted(['foo.txt', 'спам.txt', 'яйца.txt']),
|
||||
)
|
||||
|
||||
|
||||
@with_tempfile()
|
||||
def test_replace(self, name):
|
||||
'''
|
||||
|
@ -2206,10 +2209,10 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
else:
|
||||
diff = '--- \n+++ \n@@ -1 +1,3 @@\n'
|
||||
diff += (
|
||||
'+첫 번째 행\n'
|
||||
' 한국어 시험\n'
|
||||
'+마지막 행\n'
|
||||
)
|
||||
'+첫 번째 행{0}'
|
||||
' 한국어 시험{0}'
|
||||
'+마지막 행{0}'
|
||||
).format(os.linesep)
|
||||
|
||||
ret = {x.split('_|-')[1]: y for x, y in six.iteritems(result)}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue