Exit code 1 if unsanitised vulnerabilities found#156
Merged
Conversation
assert_called_with does the assertion. The function has return value None. So don't assert assert_called_with. Fixes the "This with: makes no sense" comment.
To be useful as a linter process such as in a Continuous Integration system, pyt should finish with pass or fail exit codes. Saves having to grep the output. If there are unsanitised vulnerabilities, sys.exit(1). In the future we'll probably want a flag to not print sanitised vulns.
Can now use just `pyt` exactly like `python -m pyt`. Before there was an error: AttributeError: module 'pyt' has no attribute 'main'
KevinHock
approved these changes
Jul 27, 2018
| mock_find_vulnerabilities.return_value, | ||
| mock_parse_args.return_value.output_file | ||
| ) | ||
| mock_json.report.assert_called_with( |
Collaborator
There was a problem hiding this comment.
You're my hero! :D
What was the bug? re: This with: makes no sense
Collaborator
Author
There was a problem hiding this comment.
@KevinHock no, the function mock_text.report.assert_called_with() does the assertion - it either raises AssertionError or returns None.
Therefore, if you do assert mock_text.report.assert_called_with() it's like assert None.
Collaborator
There was a problem hiding this comment.
Wow 🤦♂️ I must have had tunnel vision at the time. Thanks so much for fixing that 😄
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not sure if you want this, but having a non-zero exit code if there are vulnerabilities would help with using pyt in an automated system like CI.