mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
Make bdd assert
This commit is contained in:
@@ -16,3 +16,4 @@ 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("foo")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
import jq
|
||||||
from acme import client
|
from acme import client
|
||||||
from acme import messages
|
from acme import messages
|
||||||
from behave.runner import Context
|
from behave.runner import Context
|
||||||
@@ -104,8 +105,7 @@ def step_impl(context: Context, email: str, kid: str, secret: str, account_var:
|
|||||||
"I submit the certificate signing request PEM {pem_var} certificate order to the ACME server as {order_var}"
|
"I submit the certificate signing request PEM {pem_var} certificate order to the ACME server as {order_var}"
|
||||||
)
|
)
|
||||||
def step_impl(context: Context, pem_var: str, order_var: str):
|
def step_impl(context: Context, pem_var: str, order_var: str):
|
||||||
order = context.acme_client.new_order(context.vars[pem_var])
|
context.vars[order_var] = context.acme_client.new_order(context.vars[pem_var])
|
||||||
context.vars[order_var] = order
|
|
||||||
|
|
||||||
|
|
||||||
@when("I create certificate signing request as {csr_var}")
|
@when("I create certificate signing request as {csr_var}")
|
||||||
@@ -155,3 +155,13 @@ def step_impl(context: Context, csr_var: str, pk_var: str, pem_var: str):
|
|||||||
.sign(context.vars[pk_var], hashes.SHA256())
|
.sign(context.vars[pk_var], hashes.SHA256())
|
||||||
.public_bytes(serialization.Encoding.PEM)
|
.public_bytes(serialization.Encoding.PEM)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@then("the value {var_path} should be true for {query}")
|
||||||
|
def step_impl(context: Context, var_path: str, query: str):
|
||||||
|
parts = var_path.split(".")
|
||||||
|
value = context.vars[parts[0]]
|
||||||
|
for part in parts[1:]:
|
||||||
|
value = getattr(value, part)
|
||||||
|
result = jq.compile(query).input_value(value).first()
|
||||||
|
assert result, f"{value} does not match {query}"
|
||||||
|
|||||||
Reference in New Issue
Block a user