Skip to content

Commit ee83551

Browse files
api-clients-generation-pipeline[bot]skarimoci.datadog-api-spec
authored
Add assertions to BDD scenarios for V1 endpoints (#1352)
* fix given fixture * Regenerate client from commit 837505a7 of spec repo --------- Co-authored-by: Sherzod Karimov <[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 d73d1a9 commit ee83551

23 files changed

+179
-128
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-22 18:12:32.678592",
8-
"spec_repo_commit": "7f9c8d81"
7+
"regenerated": "2023-02-22 19:40:56.673617",
8+
"spec_repo_commit": "837505a7"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-02-22 18:12:32.771626",
13-
"spec_repo_commit": "7f9c8d81"
12+
"regenerated": "2023-02-22 19:40:56.685092",
13+
"spec_repo_commit": "837505a7"
1414
}
1515
}
1616
}

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ def undo_operation():
486486
result = glom(result, operation["source"])
487487

488488
# store response in fixtures
489-
context[operation["key"]] = result
489+
result_body_json = client.sanitize_for_serialization(result)
490+
context[operation["key"]] = result_body_json
490491

491492
return wrapper
492493

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-12T20:05:48.730Z
1+
2023-02-16T21:39:58.391Z

tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_template_variable_defaults_returns_ok_response.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interactions:
1010
uri: https://api.datadoghq.com/api/v1/dashboard
1111
response:
1212
body:
13-
string: '{"notify_list":[],"description":null,"restricted_roles":[],"author_name":null,"template_variables":[{"prefix":"host","defaults":["my-host"],"available_values":["my-host","host1","host2"],"name":"host1"}],"is_read_only":false,"id":"39h-cn5-kyd","title":"","url":"/dashboard/39h-cn5-kyd/","created_at":"2022-09-12T20:05:49.753763+00:00","modified_at":"2022-09-12T20:05:49.753763+00:00","reflow_type":"auto","author_handle":"[email protected]","widgets":[{"definition":{"requests":{"fill":{"q":"avg:system.cpu.user{*}"}},"type":"hostmap"},"id":4911408545233424}],"layout_type":"ordered"}
13+
string: '{"id":"h5n-j24-t82","title":"","description":null,"author_handle":"[email protected]","author_name":null,"layout_type":"ordered","url":"/dashboard/h5n-j24-t82/","is_read_only":false,"template_variables":[{"available_values":["my-host","host1","host2"],"defaults":["my-host"],"name":"host1","prefix":"host"}],"widgets":[{"definition":{"requests":{"fill":{"q":"avg:system.cpu.user{*}"}},"type":"hostmap"},"id":355816329429238}],"notify_list":[],"created_at":"2023-02-16T21:39:58.588908+00:00","modified_at":"2023-02-16T21:39:58.588908+00:00","reflow_type":"auto","restricted_roles":[]}
1414
1515
'
1616
headers:
@@ -25,10 +25,10 @@ interactions:
2525
accept:
2626
- application/json
2727
method: DELETE
28-
uri: https://api.datadoghq.com/api/v1/dashboard/39h-cn5-kyd
28+
uri: https://api.datadoghq.com/api/v1/dashboard/h5n-j24-t82
2929
response:
3030
body:
31-
string: '{"deleted_dashboard_id":"39h-cn5-kyd"}
31+
string: '{"deleted_dashboard_id":"h5n-j24-t82"}
3232
3333
'
3434
headers:
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-12T20:05:50.228Z
1+
2023-02-16T21:40:06.384Z

tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_template_variable_presets_using_values_returns_ok_response.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ interactions:
1111
uri: https://api.datadoghq.com/api/v1/dashboard
1212
response:
1313
body:
14-
string: '{"notify_list":[],"description":null,"restricted_roles":[],"author_name":null,"template_variable_presets":[{"template_variables":[{"values":["*","my-host"],"name":"datacenter"}],"name":"my
15-
saved view"}],"template_variables":[{"prefix":"host","defaults":["my-host"],"available_values":["my-host","host1","host2"],"name":"host1"}],"is_read_only":false,"id":"6j2-ja3-r9z","title":"","url":"/dashboard/6j2-ja3-r9z/","created_at":"2022-09-12T20:05:50.380181+00:00","modified_at":"2022-09-12T20:05:50.380181+00:00","reflow_type":"auto","author_handle":"[email protected]","widgets":[{"definition":{"requests":{"fill":{"q":"avg:system.cpu.user{*}"}},"type":"hostmap"},"id":8337056750682432}],"layout_type":"ordered"}
14+
string: '{"id":"y9d-w7h-s59","title":"","description":null,"author_handle":"[email protected]","author_name":null,"layout_type":"ordered","url":"/dashboard/y9d-w7h-s59/","is_read_only":false,"template_variables":[{"available_values":["my-host","host1","host2"],"defaults":["my-host"],"name":"host1","prefix":"host"}],"widgets":[{"definition":{"requests":{"fill":{"q":"avg:system.cpu.user{*}"}},"type":"hostmap"},"id":3953978643250660}],"notify_list":[],"created_at":"2023-02-16T21:40:06.587858+00:00","modified_at":"2023-02-16T21:40:06.587858+00:00","template_variable_presets":[{"name":"my
15+
saved view","template_variables":[{"name":"datacenter","values":["*","my-host"]}]}],"reflow_type":"auto","restricted_roles":[]}
1616
1717
'
1818
headers:
@@ -27,10 +27,10 @@ interactions:
2727
accept:
2828
- application/json
2929
method: DELETE
30-
uri: https://api.datadoghq.com/api/v1/dashboard/6j2-ja3-r9z
30+
uri: https://api.datadoghq.com/api/v1/dashboard/y9d-w7h-s59
3131
response:
3232
body:
33-
string: '{"deleted_dashboard_id":"6j2-ja3-r9z"}
33+
string: '{"deleted_dashboard_id":"y9d-w7h-s59"}
3434
3535
'
3636
headers:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-01-06T00:50:23.256Z
1+
2023-02-16T21:10:17.049Z

tests/v1/cassettes/test_scenarios/test_get_all_dashboard_lists_returns_ok_response.yaml

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
interactions:
2+
- request:
3+
body: '{"name":"Test-Get_all_dashboard_lists_returns_OK_response-1676581817"}'
4+
headers:
5+
accept:
6+
- application/json
7+
content-type:
8+
- application/json
9+
method: POST
10+
uri: https://api.datadoghq.com/api/v1/dashboard/lists/manual
11+
response:
12+
body:
13+
string: '{"author":{"name":null,"handle":"[email protected]"},"created":"2023-02-16T21:10:17.185865+00:00","dashboards":null,"dashboard_count":0,"id":364491,"is_favorite":false,"modified":"2023-02-16T21:10:17.185872+00:00","name":"Test-Get_all_dashboard_lists_returns_OK_response-1676581817","type":"manual_dashboard_list"}
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,23 +28,27 @@ interactions:
828
uri: https://api.datadoghq.com/api/v1/dashboard/lists/manual
929
response:
1030
body:
11-
string: '{"dashboard_lists":[{"is_favorite":true,"name":"frog''s List","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2020-09-08T07:12:57.679027+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2020-09-09T08:48:11.523877+00:00","id":126798},{"is_favorite":false,"name":"Test-Create_a_dashboard_list_returns_OK_response-1640112901","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-12-21T18:55:02.067838+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-21T18:55:02.067874+00:00","id":266996},{"is_favorite":false,"name":"Test-Python-Create_a_dashboard_list_returns_OK_response-1638987026","dashboard_count":0,"author":{"handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI
12-
Account"},"created":"2021-12-08T18:10:26.626691+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-08T18:10:26.626722+00:00","id":262166},{"is_favorite":false,"name":"Test-Python-Delete_a_dashboard_list_returns_OK_response-1638987033","dashboard_count":0,"author":{"handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI
13-
Account"},"created":"2021-12-08T18:10:33.174397+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-08T18:10:33.174422+00:00","id":262168},{"is_favorite":false,"name":"Test-Python-Get_a_dashboard_list_returns_OK_response-1638987029","dashboard_count":0,"author":{"handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI
14-
Account"},"created":"2021-12-08T18:10:29.487202+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-08T18:10:29.487230+00:00","id":262167},{"is_favorite":false,"name":"Test-Python-Update_a_dashboard_list_returns_OK_response-1638987040","dashboard_count":0,"author":{"handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI
15-
Account"},"created":"2021-12-08T18:10:40.138195+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-08T18:10:40.138221+00:00","id":262169},{"is_favorite":false,"name":"Test-Typescript-Create_a_dashboard_list_returns_OK_response-1640111482","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-12-21T18:31:22.557855+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-21T18:31:22.557886+00:00","id":266953},{"is_favorite":false,"name":"Test-Typescript-Create_a_dashboard_list_returns_OK_response-1640112717","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-12-21T18:51:57.727820+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-21T18:51:57.727845+00:00","id":266992},{"is_favorite":false,"name":"Test-Typescript-Create_a_dashboard_list_returns_OK_response-1640117958","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-12-21T20:19:18.398658+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-12-21T20:19:18.398694+00:00","id":267026},{"is_favorite":false,"name":"tf-TestDatadogDashListInDashboardJSON-82057-1637759559","dashboard_count":0,"author":{"handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI
16-
Account"},"created":"2021-11-24T13:12:42.098978+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-24T13:12:42.099008+00:00","id":257787},{"is_favorite":false,"name":"updated
17-
Test-Typescript-Update_a_dashboard_list_returns_OK_response-1637674353","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-23T13:32:34.191937+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-23T13:32:34.723130+00:00","id":257383},{"is_favorite":false,"name":"updated
18-
Test-Update_a_dashboard_list_returns_OK_response-1633007463","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-09-30T13:11:04.010648+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-09-30T13:11:04.132209+00:00","id":240358},{"is_favorite":false,"name":"updated
19-
Test-Update_a_dashboard_list_returns_OK_response-1633075858","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-10-01T08:10:58.489385+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-10-01T08:10:58.877699+00:00","id":240504},{"is_favorite":false,"name":"updated
20-
Test-Update_a_dashboard_list_returns_OK_response-1633075932","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-10-01T08:12:12.424522+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-10-01T08:12:12.666891+00:00","id":240508},{"is_favorite":false,"name":"updated
21-
Test-Update_a_dashboard_list_returns_OK_response-1637061196","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-16T11:13:21.037425+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-16T11:13:21.427449+00:00","id":255183},{"is_favorite":false,"name":"updated
22-
Test-Update_a_dashboard_list_returns_OK_response-1637062271","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-16T11:31:14.325320+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-16T11:31:14.670076+00:00","id":255191},{"is_favorite":false,"name":"updated
23-
Test-Update_a_dashboard_list_returns_OK_response-1637063263","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-16T11:47:45.464601+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-16T11:47:45.942232+00:00","id":255196},{"is_favorite":false,"name":"updated
24-
Test-Update_a_dashboard_list_returns_OK_response-1637070426","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-16T13:47:09.107719+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-16T13:47:09.532441+00:00","id":255273},{"is_favorite":false,"name":"updated
25-
Test-Update_a_dashboard_list_returns_OK_response-1637077860","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-16T15:51:01.035434+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-16T15:51:01.480129+00:00","id":255388},{"is_favorite":false,"name":"updated
26-
Test-Update_a_dashboard_list_returns_OK_response-1637078373","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-16T15:59:34.292076+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-16T15:59:34.662062+00:00","id":255393},{"is_favorite":false,"name":"updated
27-
Test-Update_a_dashboard_list_returns_OK_response-1637141108","dashboard_count":0,"author":{"handle":"[email protected]","name":null},"created":"2021-11-17T09:25:11.229062+00:00","type":"manual_dashboard_list","dashboards":null,"modified":"2021-11-17T09:25:11.690913+00:00","id":255558}]}'
31+
string: '{"dashboard_lists":[{"author":{"name":null,"handle":"[email protected]"},"created":"2023-02-16T21:10:17.185865+00:00","dashboards":null,"dashboard_count":0,"id":364491,"is_favorite":false,"modified":"2023-02-16T21:10:17.185872+00:00","name":"Test-Get_all_dashboard_lists_returns_OK_response-1676581817","type":"manual_dashboard_list"},{"author":{"name":null,"handle":"[email protected]"},"created":"2022-12-09T15:04:28.806069+00:00","dashboards":null,"dashboard_count":1,"id":348463,"is_favorite":false,"modified":"2022-12-09T15:04:29.985883+00:00","name":"Test-Go-TestDashboardListItemCRUD-1670598268","type":"manual_dashboard_list"}]}
32+
33+
'
34+
headers:
35+
content-type:
36+
- application/json
37+
status:
38+
code: 200
39+
message: OK
40+
- request:
41+
body: null
42+
headers:
43+
accept:
44+
- application/json
45+
method: DELETE
46+
uri: https://api.datadoghq.com/api/v1/dashboard/lists/manual/364491
47+
response:
48+
body:
49+
string: '{"deleted_dashboard_list_id":364491}
50+
51+
'
2852
headers:
2953
content-type:
3054
- application/json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-01-06T00:50:43.652Z
1+
2023-02-16T21:47:50.042Z

0 commit comments

Comments
 (0)