mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 22:26:15 +00:00
More asserts
This commit is contained in:
@@ -16,4 +16,5 @@ Feature: New 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.uri should be true for startswith("{BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/orders/")
|
Then the value order.uri should be true for jq startswith("{BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/orders/")
|
||||||
|
Then the value order.body.status.name should be "pending"
|
||||||
|
|||||||
@@ -38,6 +38,14 @@ def replace_vars(payload: dict | list | int | float | str, vars: dict):
|
|||||||
return payload
|
return payload
|
||||||
|
|
||||||
|
|
||||||
|
def eval_var(context: Context, var_path: str):
|
||||||
|
parts = var_path.split(".", 1)
|
||||||
|
value = context.vars[parts[0]]
|
||||||
|
if len(parts) == 2:
|
||||||
|
value = glom.glom(value, parts[1])
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
@given('I have an ACME cert profile as "{profile_var}"')
|
@given('I have an ACME cert profile as "{profile_var}"')
|
||||||
def step_impl(context: Context, profile_var: str):
|
def step_impl(context: Context, profile_var: str):
|
||||||
# TODO: Fixed value for now, just to make test much easier,
|
# TODO: Fixed value for now, just to make test much easier,
|
||||||
@@ -158,11 +166,15 @@ def step_impl(context: Context, csr_var: str, pk_var: str, pem_var: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@then("the value {var_path} should be true for {query}")
|
@then("the value {var_path} should be true for jq {query}")
|
||||||
def step_impl(context: Context, var_path: str, query: str):
|
def step_impl(context: Context, var_path: str, query: str):
|
||||||
parts = var_path.split(".", 1)
|
value = eval_var(context, var_path)
|
||||||
value = context.vars[parts[0]]
|
|
||||||
if len(parts) == 2:
|
|
||||||
value = glom.glom(value, parts[1])
|
|
||||||
result = jq.compile(replace_vars(query, context.vars)).input_value(value).first()
|
result = jq.compile(replace_vars(query, context.vars)).input_value(value).first()
|
||||||
assert result, f"{value} does not match {query}"
|
assert result, f"{value} does not match {query}"
|
||||||
|
|
||||||
|
|
||||||
|
@then("the value {var_path} should be {expected}")
|
||||||
|
def step_impl(context: Context, var_path: str, expected: str):
|
||||||
|
value = eval_var(context, var_path)
|
||||||
|
expected_value = json.loads(expected)
|
||||||
|
assert value == expected_value, f"{value:!r} does not match {expected_value:!r}"
|
||||||
|
|||||||
Reference in New Issue
Block a user