Add integration test for latin-1 file diffs

This commit is contained in:
Erik Johnson 2018-08-03 17:30:17 -05:00
parent 2dd1f31d23
commit 726dd4331f
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F
3 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,5 @@
<html>
<body>
r臾sm<EFBFBD>g蚶
</body>
</html>

View file

@ -0,0 +1,4 @@
<html>
<body>
</body>
</html>

View file

@ -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