mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
More test cases
This commit is contained in:
@@ -16,7 +16,28 @@ Feature: ACME Cert Profile
|
||||
}
|
||||
"""
|
||||
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.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.certificateTemplateId should be equal to "{CERT_TEMPLATE_ID}"
|
||||
Then the value response with jq .certificateProfile.enrollmentType should be equal to "acme"
|
||||
|
||||
Scenario: Reveal EAB secret
|
||||
Given I make a random slug as profile_slug
|
||||
Given I use AUTH_TOKEN for authentication
|
||||
When I send a POST request to "/api/v1/pki/certificate-profiles" with JSON payload
|
||||
"""
|
||||
{
|
||||
"projectId": "{PROJECT_ID}",
|
||||
"slug": "{profile_slug}",
|
||||
"description": "",
|
||||
"enrollmentType": "acme",
|
||||
"caId": "{CERT_CA_ID}",
|
||||
"certificateTemplateId": "{CERT_TEMPLATE_ID}",
|
||||
"acmeConfig": {}
|
||||
}
|
||||
"""
|
||||
Then the value response.status_code should be equal to 200
|
||||
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"
|
||||
Then the value response.status_code should be equal to 200
|
||||
|
||||
@@ -145,9 +145,13 @@ def step_impl(context: Context, token_var: str):
|
||||
|
||||
@when('I send a {method} request to "{url}"')
|
||||
def step_impl(context: Context, method: str, url: str):
|
||||
context.response = context.http_client.request(
|
||||
logger.debug("Sending %s request to %s", method, url)
|
||||
response = context.http_client.request(
|
||||
method, url.format(**context.vars), headers=prepare_headers(context)
|
||||
)
|
||||
context.vars["response"] = response
|
||||
logger.debug("Response status: %r", response.status_code)
|
||||
logger.debug("Response JSON payload: %r", response.json())
|
||||
|
||||
|
||||
@when('I send a {method} request to "{url}" with JSON payload')
|
||||
@@ -166,7 +170,6 @@ def step_impl(context: Context, method: str, url: str):
|
||||
headers=prepare_headers(context),
|
||||
json=json_payload,
|
||||
)
|
||||
context.response = response
|
||||
context.vars["response"] = response
|
||||
logger.debug("Response status: %r", response.status_code)
|
||||
logger.debug("Response JSON payload: %r", response.json())
|
||||
@@ -362,6 +365,22 @@ def step_impl(context: Context, var_path: str, expected: str):
|
||||
assert value == expected_value, f"{value!r} does not match {expected_value!r}"
|
||||
|
||||
|
||||
@then('I memorize {var_path} with jq "{jq_query}" as {var_name}')
|
||||
def step_impl(context: Context, var_path: str, jq_query, var_name: str):
|
||||
_, value = apply_value_with_jq(
|
||||
context=context,
|
||||
var_path=var_path,
|
||||
jq_query=jq_query,
|
||||
)
|
||||
context.vars[var_name] = value
|
||||
|
||||
|
||||
@then("I memorize {var_path} as {var_name}")
|
||||
def step_impl(context: Context, var_path: str, var_name: str):
|
||||
value = eval_var(context, var_path)
|
||||
context.vars[var_name] = value
|
||||
|
||||
|
||||
@then("I print the value {var_path}")
|
||||
def step_impl(context: Context, var_path: str):
|
||||
value = eval_var(context, var_path)
|
||||
|
||||
Reference in New Issue
Block a user