-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(common): pass None as filename to process_results
Console.process_results has a filename argument, that according to its documentation, if its None the results are only displayed but not saved to a file, and the user is not prompted for a filename. As reported in #7, the user is still prompted when passing None. This commit fixes this, and adds a test to confirm the fix and prevent regressions. Co-authored-by: Baptistin BOILOT <[email protected]>
- Loading branch information
1 parent
b6dc361
commit 3b6fef7
Showing
2 changed files
with
22 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Module to test crypto_condor.primitives.common.""" | ||
|
||
from hashlib import sha256 | ||
from pathlib import Path | ||
|
||
from crypto_condor.primitives import SHA | ||
from crypto_condor.primitives.common import Console | ||
|
||
|
||
class TestConsole: | ||
"""Tests for the Console class.""" | ||
|
||
def test_filename_none(self, tmp_path: Path): | ||
"""Tests passing None as filename. | ||
The expected behaviour is that the user is not prompted for a filename. | ||
""" | ||
rd = SHA.test(lambda msg: sha256(msg).digest(), SHA.Algorithm.SHA_256) | ||
console = Console() | ||
assert console.process_results(rd, None) |