support multiple infiles
This commit is contained in:
@@ -38,6 +38,21 @@ def test_extract_stdout(capsys):
|
||||
assert captured.err == ''
|
||||
|
||||
|
||||
def test_extract_multiple_files_and_mixed(capsys):
|
||||
# Act
|
||||
extract_otp_secret_keys.main([
|
||||
'example_export.txt',
|
||||
'test/test_googleauth_export.png',
|
||||
'example_export.txt',
|
||||
'test/test_googleauth_export.png'])
|
||||
|
||||
# Assert
|
||||
captured = capsys.readouterr()
|
||||
|
||||
assert captured.out == EXPECTED_STDOUT_FROM_EXAMPLE_EXPORT + EXPECTED_STDOUT_FROM_EXAMPLE_EXPORT_PNG + EXPECTED_STDOUT_FROM_EXAMPLE_EXPORT + EXPECTED_STDOUT_FROM_EXAMPLE_EXPORT_PNG
|
||||
assert captured.err == ''
|
||||
|
||||
|
||||
def test_extract_non_existent_file(capsys):
|
||||
# Act
|
||||
with raises(SystemExit) as e:
|
||||
@@ -498,25 +513,7 @@ def test_img_qr_reader_from_file_happy_path(capsys):
|
||||
# Assert
|
||||
captured = capsys.readouterr()
|
||||
|
||||
expected_stdout =\
|
||||
'''Name: Test1:test1@example1.com
|
||||
Secret: JBSWY3DPEHPK3PXP
|
||||
Issuer: Test1
|
||||
Type: totp
|
||||
|
||||
Name: Test2:test2@example2.com
|
||||
Secret: JBSWY3DPEHPK3PXQ
|
||||
Issuer: Test2
|
||||
Type: totp
|
||||
|
||||
Name: Test3:test3@example3.com
|
||||
Secret: JBSWY3DPEHPK3PXR
|
||||
Issuer: Test3
|
||||
Type: totp
|
||||
|
||||
'''
|
||||
|
||||
assert captured.out == expected_stdout
|
||||
assert captured.out == EXPECTED_STDOUT_FROM_EXAMPLE_EXPORT_PNG
|
||||
assert captured.err == ''
|
||||
|
||||
|
||||
@@ -664,3 +661,21 @@ Secret: 7KSQL2JTUDIS5EF65KLMRQIIGY
|
||||
Type: totp
|
||||
|
||||
'''
|
||||
|
||||
EXPECTED_STDOUT_FROM_EXAMPLE_EXPORT_PNG =\
|
||||
'''Name: Test1:test1@example1.com
|
||||
Secret: JBSWY3DPEHPK3PXP
|
||||
Issuer: Test1
|
||||
Type: totp
|
||||
|
||||
Name: Test2:test2@example2.com
|
||||
Secret: JBSWY3DPEHPK3PXQ
|
||||
Issuer: Test2
|
||||
Type: totp
|
||||
|
||||
Name: Test3:test3@example3.com
|
||||
Secret: JBSWY3DPEHPK3PXR
|
||||
Issuer: Test3
|
||||
Type: totp
|
||||
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user