mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 21:33:00 +00:00
acme: improve error handling in backend's parse_key() (#208)
* Improve error handling in backend's parse_key(). * Adjust unit tests.
This commit is contained in:
@@ -30,12 +30,10 @@ def test_eckeyparse_cryptography(pem, result, dummy, tmpdir):
|
||||
fn.write(pem)
|
||||
module = MagicMock()
|
||||
backend = CryptographyBackend(module)
|
||||
error, key = backend.parse_key(key_file=str(fn))
|
||||
assert error is None
|
||||
key = backend.parse_key(key_file=str(fn))
|
||||
key.pop('key_obj')
|
||||
assert key == result
|
||||
error, key = backend.parse_key(key_content=pem)
|
||||
assert error is None
|
||||
key = backend.parse_key(key_content=pem)
|
||||
key.pop('key_obj')
|
||||
assert key == result
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ def test_eckeyparse_openssl(pem, result, openssl_output, tmpdir):
|
||||
module = MagicMock()
|
||||
module.run_command = MagicMock(return_value=(0, openssl_output, 0))
|
||||
backend = OpenSSLCLIBackend(module, openssl_binary='openssl')
|
||||
error, key = backend.parse_key(key_file=str(fn))
|
||||
assert error is None
|
||||
key = backend.parse_key(key_file=str(fn))
|
||||
key.pop('key_file')
|
||||
assert key == result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user