pki.tests.test_util_cert_req_converterΒΆ

Tests for pki.util.cert_req_converter module.

ClassesΒΆ

TestJSONCertRequestConverterSANValueToJson

Test _san_value_to_json method.

TestJSONCertRequestConverterKUValueToJson

Test _ku_value_to_json method.

TestJSONCertRequestConverterToJson

Test to_json method.

TestJSONCertRequestConverterValidityPeriodFromJson

Test validity_period_from_json method.

TestJSONCertRequestConverterFromJson

Test from_json method.

TestJSONCertRequestCommandExtractor

Test JSONCertRequestCommandExtractor methods.

FunctionsΒΆ

private_key()

Generate a test RSA private key.

basic_csr(private_key)

Create a basic CSR for testing.

Module ContentsΒΆ

pki.tests.test_util_cert_req_converter.private_key()[source]ΒΆ

Generate a test RSA private key.

Return type:

cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey

pki.tests.test_util_cert_req_converter.basic_csr(private_key)[source]ΒΆ

Create a basic CSR for testing.

Parameters:

private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey)

Return type:

cryptography.x509.CertificateSigningRequest

class pki.tests.test_util_cert_req_converter.TestJSONCertRequestConverterSANValueToJson[source]ΒΆ

Test _san_value_to_json method.

test_san_with_dns_names()[source]ΒΆ

Test SAN conversion with DNS names.

Return type:

None

test_san_with_rfc822_names()[source]ΒΆ

Test SAN conversion with email addresses.

Return type:

None

test_san_with_uris()[source]ΒΆ

Test SAN conversion with URIs.

Return type:

None

test_san_with_ip_addresses()[source]ΒΆ

Test SAN conversion with IP addresses.

Return type:

None

test_san_with_mixed_types()[source]ΒΆ

Test SAN conversion with multiple types.

Return type:

None

class pki.tests.test_util_cert_req_converter.TestJSONCertRequestConverterKUValueToJson[source]ΒΆ

Test _ku_value_to_json method.

test_ku_digital_signature()[source]ΒΆ

Test KeyUsage with digital_signature.

Return type:

None

test_ku_key_agreement_with_encipher_only()[source]ΒΆ

Test KeyUsage with key_agreement and encipher_only.

Return type:

None

test_ku_key_agreement_with_decipher_only()[source]ΒΆ

Test KeyUsage with key_agreement and decipher_only.

Return type:

None

test_ku_all_flags()[source]ΒΆ

Test KeyUsage with all flags enabled.

Return type:

None

class pki.tests.test_util_cert_req_converter.TestJSONCertRequestConverterToJson[source]ΒΆ

Test to_json method.

test_to_json_with_none_raises_error()[source]ΒΆ

Test that to_json raises ValueError when CSR is None.

Return type:

None

test_to_json_basic_csr(basic_csr)[source]ΒΆ

Test to_json with a basic CSR.

Parameters:

basic_csr (cryptography.x509.CertificateSigningRequest)

Return type:

None

test_to_json_csr_with_san(private_key)[source]ΒΆ

Test to_json with CSR containing SAN extension.

Parameters:

private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey)

Return type:

None

test_to_json_csr_with_key_usage(private_key)[source]ΒΆ

Test to_json with CSR containing KeyUsage extension.

Parameters:

private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey)

Return type:

None

test_to_json_csr_with_extended_key_usage(private_key)[source]ΒΆ

Test to_json with CSR containing ExtendedKeyUsage extension.

Parameters:

private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey)

Return type:

None

test_to_json_csr_with_basic_constraints_ca_raises_error(private_key)[source]ΒΆ

Test to_json with CSR requesting CA certificate raises error.

Parameters:

private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey)

Return type:

None

test_to_json_with_certificate_builder(private_key)[source]ΒΆ

Test to_json with CertificateBuilder instead of CSR.

Parameters:

private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey)

Return type:

None

class pki.tests.test_util_cert_req_converter.TestJSONCertRequestConverterValidityPeriodFromJson[source]ΒΆ

Test validity_period_from_json method.

test_validity_with_duration()[source]ΒΆ

Test parsing validity with duration in seconds.

Return type:

None

test_validity_with_days()[source]ΒΆ

Test parsing validity with days.

Return type:

None

test_validity_with_hours()[source]ΒΆ

Test parsing validity with hours.

Return type:

None

test_validity_with_minutes()[source]ΒΆ

Test parsing validity with minutes.

Return type:

None

test_validity_with_seconds()[source]ΒΆ

Test parsing validity with seconds.

Return type:

None

test_validity_with_mixed_units()[source]ΒΆ

Test parsing validity with multiple units.

Return type:

None

test_validity_zero_raises_error()[source]ΒΆ

Test that zero validity raises ValueError.

Return type:

None

class pki.tests.test_util_cert_req_converter.TestJSONCertRequestConverterFromJson[source]ΒΆ

Test from_json method.

test_from_json_basic()[source]ΒΆ

Test from_json with basic subject.

Return type:

None

test_from_json_with_san()[source]ΒΆ

Test from_json with SAN extension.

Return type:

None

test_from_json_with_key_usage()[source]ΒΆ

Test from_json with KeyUsage extension.

Return type:

None

test_from_json_with_extended_key_usage()[source]ΒΆ

Test from_json with ExtendedKeyUsage extension.

Return type:

None

test_from_json_with_basic_constraints_ca_raises_error()[source]ΒΆ

Test from_json with CA BasicConstraints raises error.

Return type:

None

test_from_json_with_crl_distribution_points()[source]ΒΆ

Test from_json with CRL Distribution Points.

Return type:

None

class pki.tests.test_util_cert_req_converter.TestJSONCertRequestCommandExtractor[source]ΒΆ

Test JSONCertRequestCommandExtractor methods.

test_sample_request_to_openssl_subj_basic()[source]ΒΆ

Test converting subject to OpenSSL format.

Return type:

None

test_sample_request_to_openssl_subj_empty()[source]ΒΆ

Test converting empty subject to OpenSSL format.

Return type:

None

test_sample_request_to_openssl_cmp_sans()[source]ΒΆ

Test converting SANs to OpenSSL CMP format.

Return type:

None

test_sample_request_to_openssl_cmp_sans_critical()[source]ΒΆ

Test converting critical SANs to OpenSSL CMP format.

Return type:

None

test_sample_request_to_openssl_req_sans()[source]ΒΆ

Test converting SANs to OpenSSL req format.

Return type:

None

test_sample_request_to_openssl_req_sans_critical()[source]ΒΆ

Test converting critical SANs to OpenSSL req format.

Return type:

None

test_sample_request_to_openssl_days()[source]ΒΆ

Test extracting validity days.

Return type:

None

test_sample_request_to_openssl_days_from_duration()[source]ΒΆ

Test extracting validity days from duration.

Return type:

None