util.tests.test_fieldΒΆ

Tests for util/field.py.

ClassesΒΆ

TestUniqueNameValidator

Tests for UniqueNameValidator class.

TestGetCertificateName

Tests for get_certificate_name function.

Module ContentsΒΆ

class util.tests.test_field.TestUniqueNameValidator[source]ΒΆ

Tests for UniqueNameValidator class.

test_init()[source]ΒΆ

Test validator initialization.

Return type:

None

test_valid_names()[source]ΒΆ

Test validation of valid unique names.

Return type:

None

test_invalid_names()[source]ΒΆ

Test validation of invalid unique names.

Return type:

None

test_trailing_spaces_trimmed()[source]ΒΆ

Test that trailing spaces are trimmed before validation.

Return type:

None

test_empty_string()[source]ΒΆ

Test validation of empty string.

Return type:

None

test_non_string_input()[source]ΒΆ

Test validation with non-string input.

Return type:

None

class util.tests.test_field.TestGetCertificateName[source]ΒΆ

Tests for get_certificate_name function.

_create_test_cert(common_name=None, san_dns=None, san_uri=None)[source]ΒΆ

Helper to create a test certificate.

Parameters:
  • common_name (str | None) – Common name for subject.

  • san_dns (list[str] | None) – List of DNS names for SAN extension.

  • san_uri (list[str] | None) – List of URIs for SAN extension.

Returns:

A test x509 certificate.

Return type:

cryptography.x509.Certificate

test_get_name_from_common_name()[source]ΒΆ

Test extracting name from CN.

Return type:

None

test_get_name_from_san_dns()[source]ΒΆ

Test extracting name from SAN DNS when no CN.

Return type:

None

test_get_name_from_san_uri()[source]ΒΆ

Test extracting name from SAN URI when no CN or DNS.

Return type:

None

test_get_name_from_aoki_dev_owner()[source]ΒΆ

Test extracting name from AOKI DevOwnerID URI.

Return type:

None

test_cn_takes_priority_over_san()[source]ΒΆ

Test that CN takes priority over SAN.

Return type:

None

test_san_dns_priority_over_uri()[source]ΒΆ

Test that SAN DNS takes priority over SAN URI.

Return type:

None

test_no_cn_no_san_raises_error()[source]ΒΆ

Test that missing CN and SAN raises ValueError.

Return type:

None

test_empty_cn_falls_back_to_san()[source]ΒΆ

Test that empty CN falls back to SAN.

Return type:

None

test_bytes_cn_decoded()[source]ΒΆ

Test that bytes CN is decoded to UTF-8.

Return type:

None

test_multiple_san_entries()[source]ΒΆ

Test with multiple SAN entries of same type.

Return type:

None

test_aoki_dev_owner_with_complex_format()[source]ΒΆ

Test AOKI DevOwnerID with complex serial number.

Return type:

None