mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 01:28:13 +00:00
Fix all broken tests
This commit is contained in:
@@ -19,7 +19,7 @@ Feature: Order
|
|||||||
Then the value order.body with jq ".status" should be equal to "pending"
|
Then the value order.body with jq ".status" should be equal to "pending"
|
||||||
Then the value order.body with jq ".identifiers" should be equal to [{"type": "dns", "value": "localhost"}]
|
Then the value order.body with jq ".identifiers" should be equal to [{"type": "dns", "value": "localhost"}]
|
||||||
Then the value order.body with jq ".finalize" should match pattern {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/orders/(.+)/finalize
|
Then the value order.body with jq ".finalize" should match pattern {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/orders/(.+)/finalize
|
||||||
Then the value order.body with jq "all(.authorizations[]; startswith('{BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/authorizations/'))" should be equal to true
|
Then the value order.body with jq "all(.authorizations[]; startswith("{BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/authorizations/"))" should be equal to true
|
||||||
|
|
||||||
Scenario: Create a new order with SANs
|
Scenario: Create a new order with SANs
|
||||||
Given I have an ACME cert profile as "acme_profile"
|
Given I have an ACME cert profile as "acme_profile"
|
||||||
@@ -71,4 +71,4 @@ Feature: 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
|
||||||
|
|||||||
@@ -160,7 +160,10 @@ def step_impl(context: Context, method: str, url: str):
|
|||||||
)
|
)
|
||||||
context.vars["response"] = response
|
context.vars["response"] = response
|
||||||
logger.debug("Response status: %r", response.status_code)
|
logger.debug("Response status: %r", response.status_code)
|
||||||
logger.debug("Response JSON payload: %r", response.json())
|
try:
|
||||||
|
logger.debug("Response JSON payload: %r", response.json())
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@when('I send a {method} request to "{url}" with JSON payload')
|
@when('I send a {method} request to "{url}" with JSON payload')
|
||||||
@@ -203,14 +206,14 @@ def step_impl(context: Context, url: str):
|
|||||||
|
|
||||||
@then('the response status code should be "{expected_status_code:d}"')
|
@then('the response status code should be "{expected_status_code:d}"')
|
||||||
def step_impl(context: Context, expected_status_code: int):
|
def step_impl(context: Context, expected_status_code: int):
|
||||||
assert context.response.status_code == expected_status_code, (
|
assert context.vars["response"].status_code == expected_status_code, (
|
||||||
f"{context.response.status_code} != {expected_status_code}"
|
f"{context.vars['response'].status_code} != {expected_status_code}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@then('the response header "{header}" should contains non-empty value')
|
@then('the response header "{header}" should contains non-empty value')
|
||||||
def step_impl(context: Context, header: str):
|
def step_impl(context: Context, header: str):
|
||||||
header_value = context.response.headers.get(header)
|
header_value = context.vars["response"].headers.get(header)
|
||||||
assert header_value is not None, f"Header {header} not found in response"
|
assert header_value is not None, f"Header {header} not found in response"
|
||||||
assert header_value, (
|
assert header_value, (
|
||||||
f"Header {header} found in response, but value {header_value:!r} is empty"
|
f"Header {header} found in response, but value {header_value:!r} is empty"
|
||||||
@@ -219,7 +222,7 @@ def step_impl(context: Context, header: str):
|
|||||||
|
|
||||||
@then("the response body should match JSON value")
|
@then("the response body should match JSON value")
|
||||||
def step_impl(context: Context):
|
def step_impl(context: Context):
|
||||||
payload = context.response.json()
|
payload = context.vars["response"].json()
|
||||||
expected = json.loads(context.text)
|
expected = json.loads(context.text)
|
||||||
replaced = replace_vars(expected, context.vars)
|
replaced = replace_vars(expected, context.vars)
|
||||||
assert payload == replaced, f"{payload} != {replaced}"
|
assert payload == replaced, f"{payload} != {replaced}"
|
||||||
|
|||||||
Reference in New Issue
Block a user