Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add step to assert a field is not present #1554

Merged
merged 3 commits into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .generator/conftest.py
Original file line number Diff line number Diff line change
@@ -465,6 +465,11 @@ def expect_response_has_field(context, response_path, field):
"""Check that a response has field."""


@then(parsers.parse('the response "{response_path}" does not have field "{field}"'))
def expect_response_does_not_have_field(context, response_path, field):
"""Check that a response path does not have field."""


@then(parsers.parse('the response "{response_path}" has item with field "{key_path}" with value {value}'))
def expect_array_contains_object(context, response_path, key_path, value):
"""Check that a response attribute contains an object with the specified key and value."""
7 changes: 7 additions & 0 deletions features/step_definitions/request_steps.ts
Original file line number Diff line number Diff line change
@@ -297,6 +297,13 @@ Then(
}
);

Then(
"the response {string} does not have field {string}",
function (this: World, responsePath: string, field: string) {
expect(pathLookup(this.response, responsePath)).to.not.have.property(field);
}
);

Then(
"the response {string} has length {int}",
function (this: World, responsePath: string, fixtureLength: number) {
Loading