Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Add more steps
Fang-Pen Lind3539e1d3ae5
diff --git a/backend/bdd/features/environment.py b/backend/bdd/features/environment.pyindex 33d5238a0d..20ffe31c6e 100644--- a/backend/bdd/features/environment.py+++ b/backend/bdd/features/environment.py@@ -1,5 +1,14 @@+import os++import httpxfrom behave.runner import Context+BASE_URL = os.environ.get("INFISICAL_API_URL", "http://localhost:8080")+AUTH_TOKEN = os.environ.get("INFISICAL_TOKEN")+def before_all(context: Context):context.vars = {}+ context.http_client = httpx.Client(+ base_url=BASE_URL, headers={"Authorization": f"Bearer {AUTH_TOKEN}"}+ )diff --git a/backend/bdd/features/pki/nonce/pki-acme.feature b/backend/bdd/features/pki/nonce/pki-acme.featureindex f8a1bd890a..77f408ba30 100644--- a/backend/bdd/features/pki/nonce/pki-acme.feature+++ b/backend/bdd/features/pki/nonce/pki-acme.feature@@ -1,5 +1,6 @@Feature: NonceScenario: Generate a new nonceGiven I have a PKI project as "pki_project"- When I send a HEAD request to "/v1/pki/acme/profiles/{pki_project.id}/new-nonce"+ When I send a HEAD request to "/api/v1/pki/acme/profiles/{pki_project.id}/new-nonce"+ Then the response status code should be "200"Then the response header "Replay-Nonce" should contains non-empty valuediff --git a/backend/bdd/features/steps/pki_acme.py b/backend/bdd/features/steps/pki_acme.pyindex dd173a927c..d1ead5c23c 100644--- a/backend/bdd/features/steps/pki_acme.py+++ b/backend/bdd/features/steps/pki_acme.py@@ -1,14 +1,10 @@from behave.runner import Context-import httpxfrom behave import givenfrom behave import whenfrom behave import then-BASE_URL = "http://localhost:8080"--class PkiProject:def __init__(self, id: str):self.id = id@@ -25,11 +21,21 @@ def step_impl(context: Context, project_var: str):@when('I send a {method} request to "{url}"')def step_impl(context: Context, method: str, url: str):- with httpx.Client(base_url=BASE_URL) as client:- context.response = client.request(method, url.format(**context.vars))+ context.response = context.http_client.request(method, url.format(**context.vars))+++@then('the response status code should be "{expected_status_code}"')+def step_impl(context: Context, expected_status_code: int):+ assert context.response.status_code == expected_status_code, (+ f"{context.response.status_code} != {expected_status_code}"+ )@then('the response header "{header}" should contains non-empty value')def step_impl(context: Context, header: str):header_value = context.response.headers.get(header)- assert header_value+ print(context.response.headers)+ assert header_value is not None, f"Header {header} not found in response"+ assert header_value, (+ f"Header {header} found in response, but value {header_value:!r} is empty"+ )