mirror of
https://github.com/scito/extract_otp_secret_keys.git
synced 2025-12-06 06:44:57 +01:00
Test mutually exclusive arguments verbose and quiet (#25)
This commit is contained in:
parent
10fefacd2d
commit
eae01a07d5
2 changed files with 11 additions and 1 deletions
|
|
@ -79,7 +79,7 @@ def parse_args(sys_args):
|
|||
arg_parser.add_argument('--quiet', '-q', help='no stdout output', action='store_true')
|
||||
args = arg_parser.parse_args(sys_args)
|
||||
if args.verbose and args.quiet:
|
||||
print("The arguments --verbose and --quite are mutual exclusive.")
|
||||
print("The arguments --verbose and --quiet are mutually exclusive.")
|
||||
sys.exit(1)
|
||||
return args
|
||||
|
||||
|
|
|
|||
|
|
@ -209,6 +209,16 @@ def test_extract_help(capsys):
|
|||
assert pytest_wrapped_e.type == SystemExit
|
||||
assert pytest_wrapped_e.value.code == 0
|
||||
|
||||
def test_verbose_and_quiet(capsys):
|
||||
with raises(SystemExit) as pytest_wrapped_e:
|
||||
# Act
|
||||
extract_otp_secret_keys.main(['-v', '-q', 'example_export.txt'])
|
||||
|
||||
# Assert
|
||||
captured = capsys.readouterr()
|
||||
|
||||
assert len(captured.out) > 0
|
||||
assert 'The arguments --verbose and --quiet are mutually exclusive.' in captured.out
|
||||
|
||||
def cleanup():
|
||||
remove_file('test_example_output.csv')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue