diff options
Diffstat (limited to 'tests/test_cli.py')
| -rw-r--r-- | tests/test_cli.py | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py index 953abf4..b7913da 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # etoolkit | 1 | # etoolkit |
| 2 | # Copyright (C) 2021-2024 Simeon Simeonov | 2 | # Copyright (C) 2021-2026 Simeon Simeonov |
| 3 | 3 | ||
| 4 | # This program is free software: you can redistribute it and/or modify | 4 | # This program is free software: you can redistribute it and/or modify |
| 5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
| @@ -38,7 +38,6 @@ def test_decrypt_v1(binput, capsys, config_file, master_password): | |||
| 38 | ): | 38 | ): |
| 39 | with pytest.raises(SystemExit) as exit_info: | 39 | with pytest.raises(SystemExit) as exit_info: |
| 40 | main(['-c', f'{config_file}', '-d']) | 40 | main(['-c', f'{config_file}', '-d']) |
| 41 | assert exit_info.type == SystemExit | ||
| 42 | assert exit_info.value.code == 0 | 41 | assert exit_info.value.code == 0 |
| 43 | assert capsys.readouterr().out.strip() == 'Decrypted value: bar' | 42 | assert capsys.readouterr().out.strip() == 'Decrypted value: bar' |
| 44 | 43 | ||
| @@ -60,7 +59,6 @@ def test_decrypt_v2( | |||
| 60 | ): | 59 | ): |
| 61 | with pytest.raises(SystemExit) as exit_info: | 60 | with pytest.raises(SystemExit) as exit_info: |
| 62 | main(['-c', f'{config_file}', '-d']) | 61 | main(['-c', f'{config_file}', '-d']) |
| 63 | assert exit_info.type == SystemExit | ||
| 64 | assert exit_info.value.code == 0 | 62 | assert exit_info.value.code == 0 |
| 65 | assert capsys.readouterr().out.strip() == ( | 63 | assert capsys.readouterr().out.strip() == ( |
| 66 | f'Decrypted value: {short_value}' | 64 | f'Decrypted value: {short_value}' |
| @@ -88,7 +86,6 @@ def test_encrypt_with_echo( | |||
| 88 | ): | 86 | ): |
| 89 | with pytest.raises(SystemExit) as exit_info: | 87 | with pytest.raises(SystemExit) as exit_info: |
| 90 | main(['-c', f'{config_file}', '-e', '-E']) | 88 | main(['-c', f'{config_file}', '-e', '-E']) |
| 91 | assert exit_info.type == SystemExit | ||
| 92 | assert exit_info.value.code == 0 | 89 | assert exit_info.value.code == 0 |
| 93 | assert capsys.readouterr().out.strip() == ( | 90 | assert capsys.readouterr().out.strip() == ( |
| 94 | f'Encrypted value: {short_encrypted_value}' | 91 | f'Encrypted value: {short_encrypted_value}' |
| @@ -116,7 +113,6 @@ def test_encrypt_without_echo( | |||
| 116 | ): | 113 | ): |
| 117 | with pytest.raises(SystemExit) as exit_info: | 114 | with pytest.raises(SystemExit) as exit_info: |
| 118 | main(['-c', f'{config_file}', '-e']) | 115 | main(['-c', f'{config_file}', '-e']) |
| 119 | assert exit_info.type == SystemExit | ||
| 120 | assert exit_info.value.code == 0 | 116 | assert exit_info.value.code == 0 |
| 121 | assert capsys.readouterr().out.strip() == ( | 117 | assert capsys.readouterr().out.strip() == ( |
| 122 | f'Encrypted value: {short_encrypted_value}' | 118 | f'Encrypted value: {short_encrypted_value}' |
| @@ -139,11 +135,9 @@ def test_list(capsys, config_file, nonexistent_config_file): | |||
| 139 | 135 | ||
| 140 | with pytest.raises(SystemExit) as exit_info: | 136 | with pytest.raises(SystemExit) as exit_info: |
| 141 | main(['-c', nonexistent_config_file, '-l']) | 137 | main(['-c', nonexistent_config_file, '-l']) |
| 142 | assert exit_info.type == SystemExit | ||
| 143 | assert exit_info.value.code == errno.EIO | 138 | assert exit_info.value.code == errno.EIO |
| 144 | with pytest.raises(SystemExit) as exit_info: | 139 | with pytest.raises(SystemExit) as exit_info: |
| 145 | main(['-c', config_file, '-l']) | 140 | main(['-c', config_file, '-l']) |
| 146 | assert exit_info.type == SystemExit | ||
| 147 | assert exit_info.value.code == 0 | 141 | assert exit_info.value.code == 0 |
| 148 | assert capsys.readouterr().out.strip() == f'dev{os.linesep}secret' | 142 | assert capsys.readouterr().out.strip() == f'dev{os.linesep}secret' |
| 149 | 143 | ||
| @@ -153,7 +147,6 @@ def test_help(capsys): | |||
| 153 | 147 | ||
| 154 | with pytest.raises(SystemExit) as exit_info: | 148 | with pytest.raises(SystemExit) as exit_info: |
| 155 | main(['-h']) | 149 | main(['-h']) |
| 156 | assert exit_info.type == SystemExit | ||
| 157 | assert exit_info.value.code == 0 | 150 | assert exit_info.value.code == 0 |
| 158 | assert capsys.readouterr().out.startswith('usage: etoolkit') | 151 | assert capsys.readouterr().out.startswith('usage: etoolkit') |
| 159 | 152 | ||
| @@ -169,7 +162,6 @@ def test_generate_master_password_hash( | |||
| 169 | urandom.return_value = non_random_bytes_32 | 162 | urandom.return_value = non_random_bytes_32 |
| 170 | with pytest.raises(SystemExit) as exit_info: | 163 | with pytest.raises(SystemExit) as exit_info: |
| 171 | main(['--generate-master-password-hash']) | 164 | main(['--generate-master-password-hash']) |
| 172 | assert exit_info.type == SystemExit | ||
| 173 | assert exit_info.value.code == 0 | 165 | assert exit_info.value.code == 0 |
| 174 | assert capsys.readouterr().out.strip() == ( | 166 | assert capsys.readouterr().out.strip() == ( |
| 175 | 'Master password hash: pbkdf2_sha256$500000$uYpZM1VfAGq0CDZL2duITs076' | 167 | 'Master password hash: pbkdf2_sha256$500000$uYpZM1VfAGq0CDZL2duITs076' |
| @@ -182,7 +174,6 @@ def test_version(capsys): | |||
| 182 | 174 | ||
| 183 | with pytest.raises(SystemExit) as exit_info: | 175 | with pytest.raises(SystemExit) as exit_info: |
| 184 | main(['-v']) | 176 | main(['-v']) |
| 185 | assert exit_info.type == SystemExit | ||
| 186 | assert exit_info.value.code == 0 | 177 | assert exit_info.value.code == 0 |
| 187 | assert capsys.readouterr().out.startswith( | 178 | assert capsys.readouterr().out.startswith( |
| 188 | f'etoolkit {etoolkit.__version__}' | 179 | f'etoolkit {etoolkit.__version__}' |
