Skip to content

Commit

Permalink
transform more tests to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Sep 3, 2023
1 parent cbce240 commit 1d2204f
Show file tree
Hide file tree
Showing 9 changed files with 750 additions and 498 deletions.
22 changes: 12 additions & 10 deletions ca/django_ca/extensions/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,8 @@ def _parse_authority_information_access(
value: ParsableAuthorityInformationAccess,
) -> x509.AuthorityInformationAccess:
access_descriptions: List[x509.AccessDescription] = []
issuers: Optional[ParsableGeneralNameList] = value.get("issuers")
if issuers is None:
issuers = []

for name in issuers:
access_descriptions.append(
x509.AccessDescription(
access_method=AuthorityInformationAccessOID.CA_ISSUERS,
access_location=parse_general_name(name),
)
)
# NOTE: OCSP is first because OID is lexicographically smaller
ocsp: Optional[ParsableGeneralNameList] = value.get("ocsp")
if ocsp is None:
ocsp = []
Expand All @@ -175,6 +166,17 @@ def _parse_authority_information_access(
)
)

issuers: Optional[ParsableGeneralNameList] = value.get("issuers")
if issuers is None:
issuers = []
for name in issuers:
access_descriptions.append(
x509.AccessDescription(
access_method=AuthorityInformationAccessOID.CA_ISSUERS,
access_location=parse_general_name(name),
)
)

return x509.AuthorityInformationAccess(descriptions=access_descriptions)


Expand Down
1 change: 1 addition & 0 deletions ca/django_ca/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ def extensions_for_certificate(

access_descriptions = []
# TODO: use get_authority_information_access_extension() but it does not yet split lines
# NOTE: OCSP is first because OID is lexicographically smaller
if self.ocsp_url:
ocsp = [parse_general_name(name) for name in self.ocsp_url.splitlines()]
access_descriptions += [
Expand Down
Loading

0 comments on commit 1d2204f

Please sign in to comment.