Skip to content

Commit 311ece4

Browse files
api-clients-generation-pipeline[bot]zippolyteci.datadog-api-spec
authored
Add body step from file (#416)
* Add step for body from payload * add quotes * Regenerate client from commit 88ccf9e of spec repo Co-authored-by: Hippolyte HENRY <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 150bb4e commit 311ece4

38 files changed

+301
-291
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.4.1.dev6",
7-
"regenerated": "2021-04-29 09:18:19.213192",
8-
"spec_repo_commit": "ac83bf0"
7+
"regenerated": "2021-04-29 10:02:46.886445",
8+
"spec_repo_commit": "88ccf9e"
99
},
1010
"v2": {
1111
"apigentools_version": "1.4.1.dev6",
12-
"regenerated": "2021-04-29 09:18:42.357253",
13-
"spec_repo_commit": "ac83bf0"
12+
"regenerated": "2021-04-29 10:03:10.950194",
13+
"spec_repo_commit": "88ccf9e"
1414
}
1515
}
1616
}

tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,23 @@ def api_request(configuration, context, name):
365365
}
366366

367367

368-
@given(parsers.parse("body {data}"))
368+
@given(parsers.parse("body with value {data}"))
369369
def request_body(context, data):
370370
"""Set request body."""
371371
tpl = Template(data).render(**context)
372372
context["api_request"]["kwargs"]["body"] = json.loads(tpl)
373373

374374

375+
@given(parsers.parse("body from file \"{path}\""))
376+
def request_body_from_file(context, path, package_name):
377+
"""Set request body."""
378+
version = package_name.split(".")[-1]
379+
with open(os.path.join(os.path.dirname(__file__), version, "features", path)) as f:
380+
data = f.read()
381+
tpl = Template(data).render(**context)
382+
context["api_request"]["kwargs"]["body"] = json.loads(tpl)
383+
384+
375385
@given(parsers.parse('request contains "{name}" parameter from "{path}"'))
376386
def request_parameter(context, name, path):
377387
"""Set request parameter."""

tests/v1/features/aws_integration.feature

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,70 +12,70 @@ Feature: AWS Integration
1212
@generated @skip
1313
Scenario: Create an AWS integration returns "Bad Request" response
1414
Given new "CreateAWSAccount" request
15-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
15+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
1616
When the request is sent
1717
Then the response status is 400 Bad Request
1818

1919
@generated @skip
2020
Scenario: Create an AWS integration returns "Conflict Error" response
2121
Given new "CreateAWSAccount" request
22-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
22+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
2323
When the request is sent
2424
Then the response status is 409 Conflict Error
2525

2626
@generated @skip
2727
Scenario: Create an AWS integration returns "OK" response
2828
Given new "CreateAWSAccount" request
29-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
29+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
3030
When the request is sent
3131
Then the response status is 200 OK
3232

3333
@generated @skip
3434
Scenario: Delete a tag filtering entry returns "Bad Request" response
3535
Given new "DeleteAWSTagFilter" request
36-
And body {"account_id": "FAKEAC0FAKEAC2FAKEAC", "namespace": "elb"}
36+
And body with value {"account_id": "FAKEAC0FAKEAC2FAKEAC", "namespace": "elb"}
3737
When the request is sent
3838
Then the response status is 400 Bad Request
3939

4040
@generated @skip
4141
Scenario: Delete a tag filtering entry returns "OK" response
4242
Given new "DeleteAWSTagFilter" request
43-
And body {"account_id": "FAKEAC0FAKEAC2FAKEAC", "namespace": "elb"}
43+
And body with value {"account_id": "FAKEAC0FAKEAC2FAKEAC", "namespace": "elb"}
4444
When the request is sent
4545
Then the response status is 200 OK
4646

4747
@generated @skip
4848
Scenario: Delete an AWS integration returns "Bad Request" response
4949
Given new "DeleteAWSAccount" request
50-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
50+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
5151
When the request is sent
5252
Then the response status is 400 Bad Request
5353

5454
@generated @skip
5555
Scenario: Delete an AWS integration returns "Conflict Error" response
5656
Given new "DeleteAWSAccount" request
57-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
57+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
5858
When the request is sent
5959
Then the response status is 409 Conflict Error
6060

6161
@generated @skip
6262
Scenario: Delete an AWS integration returns "OK" response
6363
Given new "DeleteAWSAccount" request
64-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
64+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
6565
When the request is sent
6666
Then the response status is 200 OK
6767

6868
@generated @skip
6969
Scenario: Generate a new external ID returns "Bad Request" response
7070
Given new "CreateNewAWSExternalID" request
71-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
71+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
7272
When the request is sent
7373
Then the response status is 400 Bad Request
7474

7575
@generated @skip
7676
Scenario: Generate a new external ID returns "OK" response
7777
Given new "CreateNewAWSExternalID" request
78-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
78+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
7979
When the request is sent
8080
Then the response status is 200 OK
8181

@@ -112,34 +112,34 @@ Feature: AWS Integration
112112
@generated @skip
113113
Scenario: Set an AWS tag filter returns "Bad Request" response
114114
Given new "CreateAWSTagFilter" request
115-
And body {"account_id": "1234567", "namespace": "elb", "tag_filter_str": "prod*"}
115+
And body with value {"account_id": "1234567", "namespace": "elb", "tag_filter_str": "prod*"}
116116
When the request is sent
117117
Then the response status is 400 Bad Request
118118

119119
@generated @skip
120120
Scenario: Set an AWS tag filter returns "OK" response
121121
Given new "CreateAWSTagFilter" request
122-
And body {"account_id": "1234567", "namespace": "elb", "tag_filter_str": "prod*"}
122+
And body with value {"account_id": "1234567", "namespace": "elb", "tag_filter_str": "prod*"}
123123
When the request is sent
124124
Then the response status is 200 OK
125125

126126
@generated @skip
127127
Scenario: Update an AWS integration returns "Bad Request" response
128128
Given new "UpdateAWSAccount" request
129-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
129+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
130130
When the request is sent
131131
Then the response status is 400 Bad Request
132132

133133
@generated @skip
134134
Scenario: Update an AWS integration returns "Conflict Error" response
135135
Given new "UpdateAWSAccount" request
136-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
136+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
137137
When the request is sent
138138
Then the response status is 409 Conflict Error
139139

140140
@generated @skip
141141
Scenario: Update an AWS integration returns "OK" response
142142
Given new "UpdateAWSAccount" request
143-
And body {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
143+
And body with value {"access_key_id": null, "account_id": "1234567", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "excluded_regions": ["us-east-1", "us-west-2"], "filter_tags": ["<KEY>:<VALUE>"], "host_tags": ["<KEY>:<VALUE>"], "role_name": "DatadogAWSIntegrationRole", "secret_access_key": null}
144144
When the request is sent
145145
Then the response status is 200 OK

tests/v1/features/aws_logs_integration.feature

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,70 +12,70 @@ Feature: AWS Logs Integration
1212
@generated @skip
1313
Scenario: Add AWS Log Lambda ARN returns "Bad Request" response
1414
Given new "CreateAWSLambdaARN" request
15-
And body {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
15+
And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
1616
When the request is sent
1717
Then the response status is 400 Bad Request
1818

1919
@generated @skip
2020
Scenario: Add AWS Log Lambda ARN returns "OK" response
2121
Given new "CreateAWSLambdaARN" request
22-
And body {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
22+
And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
2323
When the request is sent
2424
Then the response status is 200 OK
2525

2626
@generated @skip
2727
Scenario: Check permissions for log services returns "Bad Request" response
2828
Given new "CheckAWSLogsServicesAsync" request
29-
And body {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
29+
And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
3030
When the request is sent
3131
Then the response status is 400 Bad Request
3232

3333
@generated @skip
3434
Scenario: Check permissions for log services returns "OK" response
3535
Given new "CheckAWSLogsServicesAsync" request
36-
And body {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
36+
And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
3737
When the request is sent
3838
Then the response status is 200 OK
3939

4040
@generated @skip
4141
Scenario: Check that an AWS Lambda Function exists returns "Bad Request" response
4242
Given new "CheckAWSLogsLambdaAsync" request
43-
And body {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
43+
And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
4444
When the request is sent
4545
Then the response status is 400 Bad Request
4646

4747
@generated @skip
4848
Scenario: Check that an AWS Lambda Function exists returns "OK" response
4949
Given new "CheckAWSLogsLambdaAsync" request
50-
And body {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
50+
And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
5151
When the request is sent
5252
Then the response status is 200 OK
5353

5454
@generated @skip
5555
Scenario: Delete an AWS Logs integration returns "Bad Request" response
5656
Given new "DeleteAWSLambdaARN" request
57-
And body {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
57+
And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
5858
When the request is sent
5959
Then the response status is 400 Bad Request
6060

6161
@generated @skip
6262
Scenario: Delete an AWS Logs integration returns "OK" response
6363
Given new "DeleteAWSLambdaARN" request
64-
And body {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
64+
And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"}
6565
When the request is sent
6666
Then the response status is 200 OK
6767

6868
@generated @skip
6969
Scenario: Enable an AWS Logs integration returns "Bad Request" response
7070
Given new "EnableAWSLogServices" request
71-
And body {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
71+
And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
7272
When the request is sent
7373
Then the response status is 400 Bad Request
7474

7575
@generated @skip
7676
Scenario: Enable an AWS Logs integration returns "OK" response
7777
Given new "EnableAWSLogServices" request
78-
And body {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
78+
And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]}
7979
When the request is sent
8080
Then the response status is 200 OK
8181

0 commit comments

Comments
 (0)