Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
agyoungs committed Nov 14, 2023
1 parent d20a9de commit e7ab415
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/test_file_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'))

0 comments on commit e7ab415

Please sign in to comment.