From e7ab415245d340efadad73549e6c497053522a35 Mon Sep 17 00:00:00 2001 From: Alex Youngs Date: Mon, 13 Nov 2023 18:24:32 -0600 Subject: [PATCH] Update test --- test/test_file_writing.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test_file_writing.py b/test/test_file_writing.py index ceca690..899b766 100644 --- a/test/test_file_writing.py +++ b/test/test_file_writing.py @@ -50,6 +50,7 @@ def get_files(self, cliargs): all_files = {} all_files['test_file.txt'] = """The quick brown fox jumped over the lazy dog. %s""" % cliargs all_files['path/to/test_file.txt'] = """The quick brown fox jumped over the lazy dog. %s""" % cliargs + all_files['test_file.bin'] = bytes("""The quick brown fox jumped over the lazy dog. %s""" % cliargs, 'utf-8') all_files['../outside/path/to/test_file.txt'] = """Path outside directory should be skipped""" all_files['/absolute.txt'] = """Absolute file path should be skipped""" return all_files @@ -96,5 +97,11 @@ def test_file_injection(self): self.assertIn('test_key', content) self.assertIn('test_value', content) + with open(os.path.join(td, 'test_file.bin'), 'r') as fh: # this particular binary file can be read in text mode + content = fh.read() + self.assertIn('quick brown', content) + self.assertIn('test_key', content) + self.assertIn('test_value', content) + self.assertFalse(os.path.exists('../outside/path/to/test_file.txt')) self.assertFalse(os.path.exists('/absolute.txt'))