mirror of
https://github.com/scito/extract_otp_secret_keys.git
synced 2025-12-06 06:44:57 +01:00
add export of plain otpauth url list, fix #196
This commit is contained in:
parent
1b11c4ccb5
commit
a822abbba1
6 changed files with 215 additions and 150 deletions
6
tests/data/url_list_output.txt
Normal file
6
tests/data/url_list_output.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
otpauth://totp/pi%40raspberrypi?secret=7KSQL2JTUDIS5EF65KLMRQIIGY&issuer=raspberrypi
|
||||
otpauth://totp/pi%40raspberrypi?secret=7KSQL2JTUDIS5EF65KLMRQIIGY
|
||||
otpauth://totp/pi%40raspberrypi?secret=7KSQL2JTUDIS5EF65KLMRQIIGY
|
||||
otpauth://totp/pi%40raspberrypi?secret=7KSQL2JTUDIS5EF65KLMRQIIGY&issuer=raspberrypi
|
||||
otpauth://hotp/hotp%20demo?secret=7KSQL2JTUDIS5EF65KLMRQIIGY&counter=4
|
||||
otpauth://totp/encoding%3A%20%C2%BF%C3%A4%C3%84%C3%A9%C3%89%3F%20%28demo%29?secret=7KSQL2JTUDIS5EF65KLMRQIIGY
|
||||
|
|
@ -418,6 +418,37 @@ def test_extract_txt_stdout_only_comments(capsys: pytest.CaptureFixture[str]) ->
|
|||
assert captured.err == ''
|
||||
|
||||
|
||||
def test_extract_urls(capsys: pytest.CaptureFixture[str], tmp_path: pathlib.Path) -> None:
|
||||
# Arrange
|
||||
output_file = str(tmp_path / 'test_example_url_list.txt')
|
||||
|
||||
# Act
|
||||
extract_otp_secrets.main(['-q', '-u', output_file, 'example_export.txt'])
|
||||
|
||||
# Assert
|
||||
expected_txt = read_file_to_str('tests/data/url_list_output.txt')
|
||||
actual_txt = read_file_to_str(output_file)
|
||||
|
||||
assert actual_txt == expected_txt
|
||||
|
||||
captured = capsys.readouterr()
|
||||
|
||||
assert captured.out == ''
|
||||
assert captured.err == ''
|
||||
|
||||
|
||||
def test_extract_urls_stdout(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
# Act
|
||||
extract_otp_secrets.main(['-u', '-', 'example_export.txt'])
|
||||
|
||||
# Assert
|
||||
expected_txt = read_file_to_str('tests/data/url_list_output.txt')
|
||||
captured = capsys.readouterr()
|
||||
|
||||
assert captured.out == expected_txt
|
||||
assert captured.err == ''
|
||||
|
||||
|
||||
def test_extract_not_encoded_plus(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
# Act
|
||||
extract_otp_secrets.main(['tests/data/test_plus_problem_export.txt'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue