-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression with saving results (#40)
* Fix regression with saving results * Correct CHANGELOG * Add testcase
- Loading branch information
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '2.2.0' | ||
__version__ = '2.2.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import tempfile | ||
import unittest | ||
|
||
from tell_me_your_secrets.__main__ import SignatureRecognizer | ||
from tell_me_your_secrets.processor import SignatureMatch | ||
|
||
|
||
class WriteResultsTest(unittest.TestCase): | ||
|
||
def test_write_results_to_file_no_issues(self): | ||
with tempfile.NamedTemporaryFile(suffix='.csv') as output_file: | ||
signature_recognizer = SignatureRecognizer({}, "", False, 1, write_results=True, | ||
output_path=output_file.name) | ||
signature_recognizer.write_results_to_file() | ||
self.assertEqual(b"", output_file.read()) | ||
|
||
def test_write_results_to_file_issues(self): | ||
with tempfile.NamedTemporaryFile(suffix='.csv') as output_file: | ||
signature_recognizer = SignatureRecognizer({}, "", False, 1, write_results=True, | ||
output_path=output_file.name) | ||
signature_recognizer.matched_signatures = [ | ||
SignatureMatch('Match', 'file', '/path/to/file') | ||
] | ||
|
||
signature_recognizer.write_results_to_file() | ||
self.assertEqual(b',name,part,path\n0,Match,file,/path/to/file\n', output_file.read()) |