From 41725add64fc199f0cfc6f7bef992e18e63e90e9 Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Wed, 12 Nov 2025 14:19:56 -0800 Subject: [PATCH] Fix test cases --- backend/bdd/features/pki/acme/challenge.feature | 12 ++++++++++++ backend/bdd/features/steps/utils.py | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/bdd/features/pki/acme/challenge.feature b/backend/bdd/features/pki/acme/challenge.feature index 77405b4b7..fdd5c8379 100644 --- a/backend/bdd/features/pki/acme/challenge.feature +++ b/backend/bdd/features/pki/acme/challenge.feature @@ -19,6 +19,8 @@ Feature: Challenge And I tell ACME server that challenge is ready to be verified And I poll and finalize the ACME order order as finalized_order And the value finalized_order.body with jq ".status" should be equal to "valid" + And I parse the full-chain certificate from order finalized_order as cert + And the value cert with jq ".subject.common_name" should be equal to "localhost" Scenario: Validate challenges for multiple domains Given I have an ACME cert profile as "acme_profile" @@ -44,6 +46,16 @@ Feature: Challenge And I pass all challenges with type http-01 for order in order And I poll and finalize the ACME order order as finalized_order And the value finalized_order.body with jq ".status" should be equal to "valid" + And I parse the full-chain certificate from order finalized_order as cert + And the value cert with jq ".subject.common_name" should be equal to "localhost" + And the value cert with jq "[.extensions.subjectAltName.general_names.[].value] | sort" should be equal to json + """ + [ + "example.com", + "infisical.com" + ] + """ + Scenario: Did not finish all challenges Given I have an ACME cert profile as "acme_profile" diff --git a/backend/bdd/features/steps/utils.py b/backend/bdd/features/steps/utils.py index cd967267a..df1a3f17f 100644 --- a/backend/bdd/features/steps/utils.py +++ b/backend/bdd/features/steps/utils.py @@ -154,11 +154,14 @@ def x509_cert_to_dict(cert: x509.Certificate) -> dict: def name_to_dict(name: x509.Name) -> dict: return {oid_to_name(attr.oid): attr.value for attr in name} + def dns_to_dict(dns: x509.DNSName) -> dict: + return dict(value=dns.value) + def extension_to_dict(ext): if isinstance(ext.value, x509.SubjectAlternativeName): return { "critical": ext.critical, - "general_names": [str(gn) for gn in ext.value], + "general_names": [dns_to_dict(gn) for gn in ext.value], } elif isinstance(ext.value, x509.BasicConstraints): return {