Skip to content

Commit 38251fb

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add asserts to v2 endpoints (#1357)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 836b681 commit 38251fb

31 files changed

+242
-13
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.4",
7-
"regenerated": "2023-02-28 10:12:58.070193",
8-
"spec_repo_commit": "c16e3609"
7+
"regenerated": "2023-03-01 15:45:43.208411",
8+
"spec_repo_commit": "8905444b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-02-28 10:12:58.181402",
13-
"spec_repo_commit": "c16e3609"
12+
"regenerated": "2023-03-01 15:45:43.222537",
13+
"spec_repo_commit": "8905444b"
1414
}
1515
}
1616
}

examples/v2/logs-metrics/CreateLogsMetric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
body = LogsMetricCreateRequest(
1515
data=LogsMetricCreateData(
16-
id="Example-Create_a_log_based_metric_returns_OK_response",
16+
id="ExampleCreatealogbasedmetricreturnsOKresponse",
1717
type=LogsMetricType.LOGS_METRICS,
1818
attributes=LogsMetricCreateAttributes(
1919
compute=LogsMetricCompute(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-11-21T15:36:05.545Z
1+
2023-02-24T19:02:01.538Z

tests/v2/cassettes/test_scenarios/test_create_a_logbased_metric_returns_ok_response.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"}},"id":"Test-Create_a_log_based_metric_returns_OK_response-1669044965","type":"logs_metrics"}}'
3+
body: '{"data":{"attributes":{"compute":{"aggregation_type":"distribution","include_percentiles":true,"path":"@duration"}},"id":"TestCreatealogbasedmetricreturnsOKresponse1677265321","type":"logs_metrics"}}'
44
headers:
55
accept:
66
- application/json
@@ -10,7 +10,7 @@ interactions:
1010
uri: https://api.datadoghq.com/api/v2/logs/config/metrics
1111
response:
1212
body:
13-
string: '{"data":{"attributes":{"filter":{"query":"*"},"group_by":[],"compute":{"path":"@duration","include_percentiles":true,"aggregation_type":"distribution"}},"type":"logs_metrics","id":"Test_Create_a_log_based_metric_returns_OK_response_1669044965"}}
13+
string: '{"data":{"id":"TestCreatealogbasedmetricreturnsOKresponse1677265321","attributes":{"filter":{"query":"*"},"group_by":[],"compute":{"aggregation_type":"distribution","path":"@duration","include_percentiles":true}},"type":"logs_metrics"}}
1414
1515
'
1616
headers:
@@ -25,7 +25,7 @@ interactions:
2525
accept:
2626
- '*/*'
2727
method: DELETE
28-
uri: https://api.datadoghq.com/api/v2/logs/config/metrics/Test_Create_a_log_based_metric_returns_OK_response_1669044965
28+
uri: https://api.datadoghq.com/api/v2/logs/config/metrics/TestCreatealogbasedmetricreturnsOKresponse1677265321
2929
response:
3030
body:
3131
string: '{}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-01-19T19:59:42.355Z
1+
2023-02-27T21:53:03.795Z

tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
interactions:
2+
- request:
3+
body: '{"data":{"attributes":{"policy":{"tag_key":"dc","tag_key_required":true,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}'
4+
headers:
5+
accept:
6+
- application/json
7+
content-type:
8+
- application/json
9+
method: POST
10+
uri: https://api.datadoghq.com/api/v2/monitor/policy
11+
response:
12+
body:
13+
string: '{"data":{"type":"monitor-config-policy","id":"1c8a8eea-b6e9-11ed-a4ec-da7ad0900002","attributes":{"policy_type":"tag","policy":{"tag_key":"dc","valid_tag_values":["prod","staging"],"tag_key_required":true}}}}
14+
15+
'
16+
headers:
17+
content-type:
18+
- application/json
19+
status:
20+
code: 200
21+
message: OK
222
- request:
323
body: null
424
headers:
@@ -8,7 +28,7 @@ interactions:
828
uri: https://api.datadoghq.com/api/v2/monitor/policy
929
response:
1030
body:
11-
string: '{"data":[]}
31+
string: '{"data":[{"type":"monitor-config-policy","id":"1c8a8eea-b6e9-11ed-a4ec-da7ad0900002","attributes":{"policy_type":"tag","policy":{"tag_key_required":true,"valid_tag_values":["prod","staging"],"tag_key":"dc"}}}]}
1232
1333
'
1434
headers:
@@ -17,4 +37,20 @@ interactions:
1737
status:
1838
code: 200
1939
message: OK
40+
- request:
41+
body: null
42+
headers:
43+
accept:
44+
- '*/*'
45+
method: DELETE
46+
uri: https://api.datadoghq.com/api/v2/monitor/policy/1c8a8eea-b6e9-11ed-a4ec-da7ad0900002
47+
response:
48+
body:
49+
string: ''
50+
headers:
51+
content-type:
52+
- text/html; charset=utf-8
53+
status:
54+
code: 204
55+
message: No Content
2056
version: 1

tests/v2/features/authn_mappings.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Feature: AuthN Mappings
3030
And body with value {"data": {"attributes": {"attribute_key": "{{ unique_lower_alnum }}", "attribute_value": "{{ unique }}"}, "relationships": {"role": {"data": {"id": "{{ role.data.id }}", "type": "roles"}}}, "type": "authn_mappings"}}
3131
When the request is sent
3232
Then the response status is 200 OK
33+
And the response "data.attributes.attribute_key" is equal to "{{ unique_lower_alnum }}"
34+
And the response "data.attributes.attribute_value" is equal to "{{ unique }}"
35+
And the response "data.relationships.role.data.id" is equal to "{{ role.data.id }}"
3336

3437
@generated @skip @team:DataDog/team-aaa
3538
Scenario: Delete an AuthN Mapping returns "Not Found" response
@@ -80,6 +83,10 @@ Feature: AuthN Mappings
8083
And body with value {"data": {"attributes": {"attribute_key": "member-of", "attribute_value": "Development"}, "id": "{{ authn_mapping.data.id }}", "relationships": {"role": {"data": {"id": "{{ role.data.id }}", "type": "roles"}}}, "type": "authn_mappings"}}
8184
When the request is sent
8285
Then the response status is 200 OK
86+
And the response "data.id" is equal to "{{ authn_mapping.data.id }}"
87+
And the response "data.attributes.attribute_key" is equal to "member-of"
88+
And the response "data.attributes.attribute_value" is equal to "Development"
89+
And the response "data.relationships.role.data.id" is equal to "{{ role.data.id }}"
8390

8491
@generated @skip @team:DataDog/team-aaa
8592
Scenario: Edit an AuthN Mapping returns "Unprocessable Entity" response
@@ -104,6 +111,10 @@ Feature: AuthN Mappings
104111
And request contains "authn_mapping_id" parameter from "authn_mapping.data.id"
105112
When the request is sent
106113
Then the response status is 200 OK
114+
And the response "data.id" is equal to "{{ authn_mapping.data.id }}"
115+
And the response "data.attributes.attribute_key" is equal to "{{ unique_lower_alnum }}"
116+
And the response "data.attributes.attribute_value" is equal to "{{ unique }}"
117+
And the response "data.relationships.role.data.id" is equal to "{{ role.data.id }}"
107118

108119
@team:DataDog/team-aaa
109120
Scenario: List all AuthN Mappings returns "OK" response
@@ -112,3 +123,4 @@ Feature: AuthN Mappings
112123
And new "ListAuthNMappings" request
113124
When the request is sent
114125
Then the response status is 200 OK
126+
And the response "data[0].type" is equal to "authn_mappings"

tests/v2/features/ci_visibility_pipelines.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Feature: CI Visibility Pipelines
2020
And body with value {"compute": [{"aggregation": "pc90", "metric": "@duration", "type": "total"}], "filter": {"from": "now-15m", "query": "@ci.provider.name:(gitlab OR github)", "to": "now"}, "group_by": [{ "facet": "@ci.status", "limit": 10, "total": false}], "options": {"timezone": "GMT"}}
2121
When the request is sent
2222
Then the response status is 200 OK
23+
And the response "meta.status" is equal to "done"
2324

2425
@generated @skip @team:Datadog/ci-app-backend @team:Datadog/integrations-tools-and-libraries
2526
Scenario: Get a list of pipelines events returns "Bad Request" response

tests/v2/features/ci_visibility_tests.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Feature: CI Visibility Tests
2020
And body with value {"compute": [{"aggregation": "count", "metric": "@test.is_flaky", "type": "total"}], "filter": {"from": "now-15m", "query": "@language:(python OR go)", "to": "now"}, "group_by": [{"facet": "@git.branch", "limit": 10, "sort": {"order": "asc"}, "total": false}], "options": {"timezone": "GMT"}}
2121
When the request is sent
2222
Then the response status is 200 OK
23+
And the response "meta.status" is equal to "done"
2324

2425
@generated @skip @team:Datadog/ci-app-backend @team:Datadog/integrations-tools-and-libraries
2526
Scenario: Get a list of tests events returns "Bad Request" response

tests/v2/features/cloudflare_integration.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Feature: Cloudflare Integration
3535
And body with value {"data": {"attributes": {"api_key": "6Zm7WEgKzAlCnt_4exfEK0mSoeHHAaDf41O1AAfu", "email": "new@email", "name": "{{ unique_lower_alnum }}"}, "type": "cloudflare-accounts"}}
3636
When the request is sent
3737
Then the response status is 201 CREATED
38+
And the response "data.type" is equal to "cloudflare-accounts"
39+
And the response "data.attributes.email" is equal to "new@email"
40+
And the response "data.attributes.name" is equal to "{{ unique_lower_alnum }}"
3841

3942
@generated @skip @team:Datadog/web-integrations
4043
Scenario: Add Cloudflare account returns "Not Found" response
@@ -85,6 +88,9 @@ Feature: Cloudflare Integration
8588
And request contains "account_id" parameter from "cloudflare_account.data.id"
8689
When the request is sent
8790
Then the response status is 200 OK
91+
And the response "data.type" is equal to "cloudflare-accounts"
92+
And the response "data.attributes.email" is equal to "[email protected]"
93+
And the response "data.attributes.name" is equal to "{{ unique_lower_alnum }}"
8894

8995
@generated @skip @team:Datadog/web-integrations
9096
Scenario: List Cloudflare accounts returns "Bad Request" response
@@ -104,6 +110,7 @@ Feature: Cloudflare Integration
104110
And new "ListCloudflareAccounts" request
105111
When the request is sent
106112
Then the response status is 200 OK
113+
And the response "data[0].type" is equal to "cloudflare-accounts"
107114

108115
@generated @skip @team:Datadog/web-integrations
109116
Scenario: Update Cloudflare account returns "Bad Request" response

0 commit comments

Comments
 (0)