mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add integration test for latin-1 file diffs
This commit is contained in:
parent
2dd1f31d23
commit
726dd4331f
3 changed files with 32 additions and 0 deletions
5
tests/integration/files/file/base/issue-48777/new.html
Normal file
5
tests/integration/files/file/base/issue-48777/new.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
r臾sm<EFBFBD>g蚶
|
||||
</body>
|
||||
</html>
|
4
tests/integration/files/file/base/issue-48777/old.html
Normal file
4
tests/integration/files/file/base/issue-48777/old.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
<html>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
|
@ -710,6 +710,29 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
if os.path.exists(name):
|
||||
os.remove(name)
|
||||
|
||||
@with_tempfile(create=False)
|
||||
def test_managed_latin1_diff(self, name):
|
||||
'''
|
||||
Tests that latin-1 file contents are represented properly in the diff
|
||||
'''
|
||||
# Lay down the initial file
|
||||
ret = self.run_state(
|
||||
'file.managed',
|
||||
name=name,
|
||||
source='salt://issue-48777/old.html')
|
||||
ret = ret[next(iter(ret))]
|
||||
assert ret['result'] is True, ret
|
||||
|
||||
# Replace it with the new file and check the diff
|
||||
ret = self.run_state(
|
||||
'file.managed',
|
||||
name=name,
|
||||
source='salt://issue-48777/new.html')
|
||||
ret = ret[next(iter(ret))]
|
||||
assert ret['result'] is True, ret
|
||||
diff_lines = ret['changes']['diff'].split('\n')
|
||||
assert '+räksmörgås' in diff_lines, diff_lines
|
||||
|
||||
def test_directory(self):
|
||||
'''
|
||||
file.directory
|
||||
|
|
Loading…
Add table
Reference in a new issue