Add quote for jq

This commit is contained in:
Fang-Pen Lin
2025-11-07 09:20:07 -08:00
parent 4f5e1760d4
commit 5b2c0583e0
4 changed files with 19 additions and 19 deletions
+4 -4
View File
@@ -17,8 +17,8 @@ Feature: Authorization
Then I sign the certificate signing request csr with private key cert_key and output it as csr_pem in PEM format Then I sign the certificate signing request csr with private key cert_key and output it as csr_pem in PEM format
Then I submit the certificate signing request PEM csr_pem certificate order to the ACME server as order Then I submit the certificate signing request PEM csr_pem certificate order to the ACME server as order
Then the value order.authorizations[0].uri with jq . should match pattern {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/authorizations/(.+) Then the value order.authorizations[0].uri with jq . should match pattern {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/authorizations/(.+)
Then the value order.authorizations[0].body with jq .status should be equal to "pending" Then the value order.authorizations[0].body with jq ".status" should be equal to "pending"
Then the value order.authorizations[0].body with jq .challenges | map(pick(.type, .status)) | sort_by(.type) should be equal to json Then the value order.authorizations[0].body with jq ".challenges | map(pick(.type, .status)) | sort_by(.type)" should be equal to json
""" """
[ [
{ {
@@ -27,8 +27,8 @@ Feature: Authorization
} }
] ]
""" """
Then the value order.authorizations[0].body with jq .challenges | map(.status) | sort should be equal to ["pending"] Then the value order.authorizations[0].body with jq ".challenges | map(.status) | sort" should be equal to ["pending"]
Then the value order.authorizations[0].body with jq .identifier should be equal to json Then the value order.authorizations[0].body with jq ".identifier" should be equal to json
""" """
{ {
"type": "dns", "type": "dns",
@@ -16,11 +16,11 @@ Feature: ACME Cert Profile
} }
""" """
Then the value response.status_code should be equal to 200 Then the value response.status_code should be equal to 200
Then the value response with jq .certificateProfile.id should be present Then the value response with jq ".certificateProfile.id" should be present
Then the value response with jq .certificateProfile.slug should be equal to "{profile_slug}" Then the value response with jq ".certificateProfile.slug" should be equal to "{profile_slug}"
Then the value response with jq .certificateProfile.caId should be equal to "{CERT_CA_ID}" Then the value response with jq ".certificateProfile.caId" should be equal to "{CERT_CA_ID}"
Then the value response with jq .certificateProfile.certificateTemplateId should be equal to "{CERT_TEMPLATE_ID}" Then the value response with jq ".certificateProfile.certificateTemplateId" should be equal to "{CERT_TEMPLATE_ID}"
Then the value response with jq .certificateProfile.enrollmentType should be equal to "acme" Then the value response with jq ".certificateProfile.enrollmentType" should be equal to "acme"
Scenario: Reveal EAB secret Scenario: Reveal EAB secret
Given I make a random slug as profile_slug Given I make a random slug as profile_slug
@@ -41,5 +41,5 @@ Feature: ACME Cert Profile
And I memorize response with jq ".certificateProfile.id" as profile_id And I memorize response with jq ".certificateProfile.id" as profile_id
When I send a GET request to "/api/v1/pki/certificate-profiles/{profile_id}/acme/eab-secret/reveal" When I send a GET request to "/api/v1/pki/certificate-profiles/{profile_id}/acme/eab-secret/reveal"
Then the value response.status_code should be equal to 200 Then the value response.status_code should be equal to 200
Then the value response with jq .eabKid should be equal to "{profile_id}" Then the value response with jq ".eabKid" should be equal to "{profile_id}"
Then the value response with jq .eabSecret should be present Then the value response with jq ".eabSecret" should be present
+5 -5
View File
@@ -45,7 +45,7 @@ Feature: Order
Then I create a RSA private key pair as cert_key Then I create a RSA private key pair as cert_key
Then I sign the certificate signing request csr with private key cert_key and output it as csr_pem in PEM format Then I sign the certificate signing request csr with private key cert_key and output it as csr_pem in PEM format
Then I submit the certificate signing request PEM csr_pem certificate order to the ACME server as order Then I submit the certificate signing request PEM csr_pem certificate order to the ACME server as order
Then the value order.body with jq .identifiers | sort_by(.value) should be equal to json Then the value order.body with jq ".identifiers | sort_by(.value)" should be equal to json
""" """
[ [
{"type": "dns", "value": "example.com"}, {"type": "dns", "value": "example.com"},
@@ -71,7 +71,7 @@ Feature: Order
Then I sign the certificate signing request csr with private key cert_key and output it as csr_pem in PEM format Then I sign the certificate signing request csr with private key cert_key and output it as csr_pem in PEM format
Then I submit the certificate signing request PEM csr_pem certificate order to the ACME server as order Then I submit the certificate signing request PEM csr_pem certificate order to the ACME server as order
Then I send an ACME post-as-get to order.uri as fetched_order Then I send an ACME post-as-get to order.uri as fetched_order
Then the value fetched_order with jq .status should be equal to "pending" Then the value fetched_order with jq ".status" should be equal to "pending"
Then the value fetched_order with jq .identifiers should be equal to [{"type": "dns", "value": "localhost"}] Then the value fetched_order with jq ".identifiers" should be equal to [{"type": "dns", "value": "localhost"}]
Then the value fetched_order with jq .finalize should match pattern {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/orders/(.+)/finalize Then the value fetched_order with jq ".finalize" should match pattern {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/orders/(.+)/finalize
Then the value fetched_order with jq all(.authorizations[]; startswith("{BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/authorizations/")) should be equal to true Then the value fetched_order with jq "all(.authorizations[]; startswith('{BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/authorizations/'))" should be equal to true
+3 -3
View File
@@ -314,7 +314,7 @@ def step_impl(context: Context, var_path: str, jq_query: str):
) )
@then("the value {var_path} with jq {jq_query} should be present") @then('the value {var_path} with jq "{jq_query}" should be present')
def step_impl(context: Context, var_path: str, jq_query: str): def step_impl(context: Context, var_path: str, jq_query: str):
value, result = apply_value_with_jq( value, result = apply_value_with_jq(
context=context, context=context,
@@ -326,7 +326,7 @@ def step_impl(context: Context, var_path: str, jq_query: str):
) )
@then("the value {var_path} with jq {jq_query} should be equal to {expected}") @then('the value {var_path} with jq "{jq_query}" should be equal to {expected}')
def step_impl(context: Context, var_path: str, jq_query: str, expected: str): def step_impl(context: Context, var_path: str, jq_query: str, expected: str):
value, result = apply_value_with_jq( value, result = apply_value_with_jq(
context=context, context=context,
@@ -339,7 +339,7 @@ def step_impl(context: Context, var_path: str, jq_query: str, expected: str):
) )
@then("the value {var_path} with jq {jq_query} should match pattern {regex}") @then('the value {var_path} with jq "{jq_query}" should match pattern {regex}')
def step_impl(context: Context, var_path: str, jq_query: str, regex: str): def step_impl(context: Context, var_path: str, jq_query: str, regex: str):
value, result = apply_value_with_jq( value, result = apply_value_with_jq(
context=context, context=context,