mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 13:22:58 +00:00
Ensure that *everything* is typed in community.crypto (#917)
* Ensure that *everything* is typed in community.crypto. * Fix comment. * Ignore type definitions/imports and AssertionErrors for code coverage.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import pathlib
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
@@ -104,7 +105,7 @@ def test_serialize_asn1_string_as_der_invalid_type() -> None:
|
||||
|
||||
@pytest.mark.skip() # This is to just to build the test case assertions and shouldn't run normally.
|
||||
@pytest.mark.parametrize("value, expected", TEST_CASES)
|
||||
def test_test_cases(value: str, expected: bytes, tmp_path) -> None:
|
||||
def test_test_cases(value: str, expected: bytes, tmp_path: pathlib.Path) -> None:
|
||||
test_file = tmp_path / "test.der"
|
||||
subprocess.run(
|
||||
["openssl", "asn1parse", "-genstr", value, "-noout", "-out", test_file],
|
||||
|
||||
@@ -254,6 +254,6 @@ def test_parse_dn(name: bytes, expected: list[NameAttribute]) -> None:
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_parse_dn_failure(name: bytes, message: str):
|
||||
def test_parse_dn_failure(name: bytes, message: str) -> None:
|
||||
with pytest.raises(OpenSSLObjectError, match=f"^{re.escape(message)}$"):
|
||||
_parse_dn(name)
|
||||
|
||||
@@ -60,7 +60,7 @@ def test_pem_handling(
|
||||
pems: list[str],
|
||||
is_pem: bool,
|
||||
private_key_type: t.Literal["raw", "pkcs1", "pkcs8", "unknown-pem"],
|
||||
):
|
||||
) -> None:
|
||||
assert identify_pem_format(data) == is_pem
|
||||
assert identify_private_key_format(data) == private_key_type
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user