Skip to content

Commit 45d7afb

Browse files
api-clients-generation-pipeline[bot]skarimoci.datadog-api-spec
authored
Add new has field assertion (#1243)
* add new assertion * fix example * fix example * Regenerate client from commit e70d9c5c of spec repo --------- Co-authored-by: Sherzod Karimov <sherzod.karimov@datadoghq.com> Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 9b240f4 commit 45d7afb

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.5",
7-
"regenerated": "2023-07-14 14:04:17.404156",
8-
"spec_repo_commit": "3868f953"
7+
"regenerated": "2023-07-17 14:34:07.547534",
8+
"spec_repo_commit": "e70d9c5c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-07-14 14:04:17.421016",
13-
"spec_repo_commit": "3868f953"
12+
"regenerated": "2023-07-17 14:34:07.560968",
13+
"spec_repo_commit": "e70d9c5c"
1414
}
1515
}
1616
}

.generator/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,17 @@ def expect_response_items(context, fixture_length):
459459
def expect_false(context, response_path):
460460
"""Check that a response attribute is false."""
461461

462+
463+
@then(parsers.parse('the response "{response_path}" has field "{field}"'))
464+
def expect_response_has_field(context, response_path, field):
465+
"""Check that a response has field."""
466+
467+
462468
@then(parsers.parse('the response "{response_path}" has item with field "{key_path}" with value {value}'))
463469
def expect_array_contains_object(context, response_path, key_path, value):
464470
"""Check that a response attribute contains an object with the specified key and value."""
465471

472+
466473
@then(parsers.parse('the response "{response_path}" array contains value {value}'))
467474
def expect_array_contains_value(context, response_path, value):
468475
"""Check that a response array contains the specified value."""

features/step_definitions/request_steps.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ Then(
277277
}
278278
);
279279

280+
Then(
281+
"the response {string} has field {string}",
282+
function (this: World, responsePath: string, field: string) {
283+
expect(pathLookup(this.response, responsePath)).to.have.property(field);
284+
}
285+
);
286+
280287
Then(
281288
"the response {string} has length {int}",
282289
function (this: World, responsePath: string, fixtureLength: number) {

features/v2/teams.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Feature: Teams
5555
And body with value {"data": {"attributes": {"handle": "handle-{{ unique_hash }}", "name": "name-{{ unique_hash }}"}, "relationships": {"users": {"data": []}}, "type": "team"}}
5656
When the request is sent
5757
Then the response status is 201 CREATED
58+
And the response "data" has field "id"
5859

5960
@team:DataDog/core-app
6061
Scenario: Get a team link returns "API error response." response

0 commit comments

Comments
 (0)