Skip to content

Commit 845de8e

Browse files
authored
Enable body matching in VCR (#378)
We didn't enable body matching, so we didn't test whether it matches on replay. This fixes and re-record the ones that didn't match.
1 parent 4408687 commit 845de8e

15 files changed

+176
-161
lines changed

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def vcr_config():
249249
config = dict(
250250
filter_headers=("DD-API-KEY", "DD-APPLICATION-KEY"),
251251
filter_query_parameters=("api_key", "application_key"),
252+
match_on=['method', 'scheme', 'host', 'port', 'path', 'query', 'body']
252253
)
253254
if tracer:
254255
config["ignore_hosts"] = [tracer.writer._hostname]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021-04-09T16:17:03.866538+02:00
1+
2021-04-14T09:52:03.634557+02:00

tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
33
body: '{"type": "metric", "description": "string", "groups": ["env:test", "role:mysql"],
4-
"monitor_ids": [], "name": "datadog-api-client-python-test_create_an_slo_object_returns_ok_response-1617977823.866538",
4+
"monitor_ids": [], "name": "Test-Create_an_SLO_object_returns_OK_response-1618386724",
55
"query": {"denominator": "sum:httpservice.hits{!code:3xx}.as_count()", "numerator":
66
"sum:httpservice.hits{code:2xx}.as_count()"}, "tags": ["env:prod", "app:core"],
77
"thresholds": [{"target": 95.0, "target_display": "95.0", "timeframe": "7d",
@@ -14,22 +14,22 @@ interactions:
1414
Dd-Operation-Id:
1515
- CreateSlo
1616
User-Agent:
17-
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.7.9; os Darwin; arch
17+
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.8.8; os Darwin; arch
1818
x86_64)
1919
method: POST
2020
uri: https://api.datadoghq.com/api/v1/slo
2121
response:
2222
body:
23-
string: '{"data":[{"description":"string","monitor_tags":[],"creator":{"handle":"[email protected]","name":null,"email":"[email protected]"},"thresholds":[{"warning":98.0,"warning_display":"98.","target":95.0,"target_display":"95.","timeframe":"7d"}],"groups":["env:test","role:mysql"],"type_id":1,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"id":"324305dde65658ada6a47adcf320618b","name":"datadog-api-client-python-test_create_an_slo_object_returns_ok_response-1617977823.866538","created_at":1617977824,"tags":["app:core","env:prod"],"modified_at":1617977824,"type":"metric"}],"error":null}'
23+
string: '{"data":[{"description":"string","monitor_tags":[],"creator":{"handle":"[email protected]","name":null,"email":"[email protected]"},"thresholds":[{"warning":98.0,"warning_display":"98.","target":95.0,"target_display":"95.","timeframe":"7d"}],"groups":["env:test","role:mysql"],"type_id":1,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"id":"27593afa4fb35e89be67633dddcae50c","name":"Test-Create_an_SLO_object_returns_OK_response-1618386724","created_at":1618386724,"tags":["app:core","env:prod"],"modified_at":1618386724,"type":"metric"}],"error":null}'
2424
headers:
2525
Connection:
2626
- keep-alive
2727
Content-Length:
28-
- '666'
28+
- '633'
2929
Content-Type:
3030
- application/json
3131
Date:
32-
- Fri, 09 Apr 2021 14:17:04 GMT
32+
- Wed, 14 Apr 2021 07:52:04 GMT
3333
cache-control:
3434
- no-cache
3535
content-security-policy:
@@ -43,7 +43,7 @@ interactions:
4343
x-content-type-options:
4444
- nosniff
4545
x-dd-version:
46-
- '35.4276613'
46+
- '35.4306674'
4747
x-frame-options:
4848
- SAMEORIGIN
4949
x-ratelimit-limit:
@@ -67,13 +67,13 @@ interactions:
6767
Dd-Operation-Id:
6868
- DeleteSlo
6969
User-Agent:
70-
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.7.9; os Darwin; arch
70+
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.8.8; os Darwin; arch
7171
x86_64)
7272
method: DELETE
73-
uri: https://api.datadoghq.com/api/v1/slo/324305dde65658ada6a47adcf320618b
73+
uri: https://api.datadoghq.com/api/v1/slo/27593afa4fb35e89be67633dddcae50c
7474
response:
7575
body:
76-
string: '{"data":["324305dde65658ada6a47adcf320618b"],"error":null}'
76+
string: '{"data":["27593afa4fb35e89be67633dddcae50c"],"error":null}'
7777
headers:
7878
Connection:
7979
- keep-alive
@@ -82,7 +82,7 @@ interactions:
8282
Content-Type:
8383
- application/json
8484
Date:
85-
- Fri, 09 Apr 2021 14:17:04 GMT
85+
- Wed, 14 Apr 2021 07:52:04 GMT
8686
cache-control:
8787
- no-cache
8888
content-security-policy:
@@ -96,15 +96,15 @@ interactions:
9696
x-content-type-options:
9797
- nosniff
9898
x-dd-version:
99-
- '35.4276613'
99+
- '35.4306674'
100100
x-frame-options:
101101
- SAMEORIGIN
102102
x-ratelimit-limit:
103103
- '3000'
104104
x-ratelimit-period:
105105
- '10'
106106
x-ratelimit-remaining:
107-
- '2998'
107+
- '2999'
108108
x-ratelimit-reset:
109109
- '6'
110110
status:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021-04-09T16:17:06.422617+02:00
1+
2021-04-14T09:55:24.418098+02:00

tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"type": "metric", "name": "datadog-api-client-python-test_delete_an_slo_returns_ok_response-1617977826.422617",
3+
body: '{"type": "metric", "name": "Test-Delete_an_SLO_returns_OK_response-1618386924",
44
"thresholds": [{"timeframe": "7d", "target": 95.0, "warning": 98.0}], "query":
55
{"numerator": "sum:httpservice.hits{code:2xx}.as_count()", "denominator": "sum:httpservice.hits{!code:3xx}.as_count()"}}'
66
headers:
@@ -11,22 +11,22 @@ interactions:
1111
Dd-Operation-Id:
1212
- CreateSlo
1313
User-Agent:
14-
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.7.9; os Darwin; arch
14+
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.8.8; os Darwin; arch
1515
x86_64)
1616
method: POST
1717
uri: https://api.datadoghq.com/api/v1/slo
1818
response:
1919
body:
20-
string: '{"data":[{"description":"","monitor_tags":[],"creator":{"handle":"[email protected]","name":null,"email":"[email protected]"},"thresholds":[{"warning":98.0,"warning_display":"98.","target":95.0,"target_display":"95.","timeframe":"7d"}],"type_id":1,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"id":"8c9f80b7df085cd1b4fb6648c3ff3226","name":"datadog-api-client-python-test_delete_an_slo_returns_ok_response-1617977826.422617","created_at":1617977827,"tags":[],"modified_at":1617977827,"type":"metric"}],"error":null}'
20+
string: '{"data":[{"description":"","monitor_tags":[],"creator":{"handle":"[email protected]","name":null,"email":"[email protected]"},"thresholds":[{"warning":98.0,"warning_display":"98.","target":95.0,"target_display":"95.","timeframe":"7d"}],"type_id":1,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"id":"0418feb3f8e35a9895eec945778fdaad","name":"Test-Delete_an_SLO_returns_OK_response-1618386924","created_at":1618386925,"tags":[],"modified_at":1618386925,"type":"metric"}],"error":null}'
2121
headers:
2222
Connection:
2323
- keep-alive
2424
Content-Length:
25-
- '597'
25+
- '564'
2626
Content-Type:
2727
- application/json
2828
Date:
29-
- Fri, 09 Apr 2021 14:17:07 GMT
29+
- Wed, 14 Apr 2021 07:55:25 GMT
3030
cache-control:
3131
- no-cache
3232
content-security-policy:
@@ -40,17 +40,17 @@ interactions:
4040
x-content-type-options:
4141
- nosniff
4242
x-dd-version:
43-
- '35.4276613'
43+
- '35.4306674'
4444
x-frame-options:
4545
- SAMEORIGIN
4646
x-ratelimit-limit:
4747
- '500'
4848
x-ratelimit-period:
4949
- '60'
5050
x-ratelimit-remaining:
51-
- '497'
51+
- '499'
5252
x-ratelimit-reset:
53-
- '53'
53+
- '36'
5454
status:
5555
code: 200
5656
message: OK
@@ -64,13 +64,13 @@ interactions:
6464
Dd-Operation-Id:
6565
- DeleteSlo
6666
User-Agent:
67-
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.7.9; os Darwin; arch
67+
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.8.8; os Darwin; arch
6868
x86_64)
6969
method: DELETE
70-
uri: https://api.datadoghq.com/api/v1/slo/8c9f80b7df085cd1b4fb6648c3ff3226
70+
uri: https://api.datadoghq.com/api/v1/slo/0418feb3f8e35a9895eec945778fdaad
7171
response:
7272
body:
73-
string: '{"data":["8c9f80b7df085cd1b4fb6648c3ff3226"],"error":null}'
73+
string: '{"data":["0418feb3f8e35a9895eec945778fdaad"],"error":null}'
7474
headers:
7575
Connection:
7676
- keep-alive
@@ -79,7 +79,7 @@ interactions:
7979
Content-Type:
8080
- application/json
8181
Date:
82-
- Fri, 09 Apr 2021 14:17:09 GMT
82+
- Wed, 14 Apr 2021 07:55:25 GMT
8383
cache-control:
8484
- no-cache
8585
content-security-policy:
@@ -93,17 +93,17 @@ interactions:
9393
x-content-type-options:
9494
- nosniff
9595
x-dd-version:
96-
- '35.4276613'
96+
- '35.4306674'
9797
x-frame-options:
9898
- SAMEORIGIN
9999
x-ratelimit-limit:
100100
- '3000'
101101
x-ratelimit-period:
102102
- '10'
103103
x-ratelimit-remaining:
104-
- '2997'
104+
- '2999'
105105
x-ratelimit-reset:
106-
- '1'
106+
- '5'
107107
status:
108108
code: 200
109109
message: OK
@@ -117,13 +117,13 @@ interactions:
117117
Dd-Operation-Id:
118118
- DeleteSlo
119119
User-Agent:
120-
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.7.9; os Darwin; arch
120+
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.8.8; os Darwin; arch
121121
x86_64)
122122
method: DELETE
123-
uri: https://api.datadoghq.com/api/v1/slo/8c9f80b7df085cd1b4fb6648c3ff3226
123+
uri: https://api.datadoghq.com/api/v1/slo/0418feb3f8e35a9895eec945778fdaad
124124
response:
125125
body:
126-
string: '{"errors": ["SLO not found: 8c9f80b7df085cd1b4fb6648c3ff3226 not found"]}'
126+
string: '{"errors": ["SLO not found: 0418feb3f8e35a9895eec945778fdaad not found"]}'
127127
headers:
128128
Connection:
129129
- keep-alive
@@ -132,7 +132,7 @@ interactions:
132132
Content-Type:
133133
- application/json
134134
Date:
135-
- Fri, 09 Apr 2021 14:17:10 GMT
135+
- Wed, 14 Apr 2021 07:55:25 GMT
136136
cache-control:
137137
- no-cache
138138
content-security-policy:
@@ -146,17 +146,17 @@ interactions:
146146
x-content-type-options:
147147
- nosniff
148148
x-dd-version:
149-
- '35.4276613'
149+
- '35.4306674'
150150
x-frame-options:
151151
- SAMEORIGIN
152152
x-ratelimit-limit:
153153
- '3000'
154154
x-ratelimit-period:
155155
- '10'
156156
x-ratelimit-remaining:
157-
- '2999'
157+
- '2998'
158158
x-ratelimit-reset:
159-
- '10'
159+
- '5'
160160
status:
161161
code: 404
162162
message: Not Found
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021-04-09T22:21:15.303905+02:00
1+
2021-04-14T09:55:32.503966+02:00

tests/v2/cassettes/test_scenarios/test_create_a_logbased_metric_returns_ok_response.yaml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"data": {"id": "Test-Create_a_logbased_metric_returns_OK_response-1617999675",
3+
body: '{"data": {"id": "Test-Create_a_log_based_metric_returns_OK_response-1618386933",
44
"type": "logs_metrics", "attributes": {"compute": {"aggregation_type": "count"}}}}'
55
headers:
66
Accept:
@@ -10,21 +10,22 @@ interactions:
1010
Dd-Operation-Id:
1111
- CreateLogsMetric
1212
User-Agent:
13-
- datadog-api-client-python/1.0.0b8.dev29 (python 3.8.8; os Darwin; arch x86_64)
13+
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.8.8; os Darwin; arch
14+
x86_64)
1415
method: POST
1516
uri: https://api.datadoghq.com/api/v2/logs/config/metrics
1617
response:
1718
body:
18-
string: '{"data":{"id":"Test_Create_a_logbased_metric_returns_OK_response_1617999675","attributes":{"filter":{"query":"*"},"group_by":[],"compute":{"aggregation_type":"count"}},"type":"logs_metrics"}}'
19+
string: '{"data":{"id":"Test_Create_a_log_based_metric_returns_OK_response_1618386933","attributes":{"filter":{"query":"*"},"group_by":[],"compute":{"aggregation_type":"count"}},"type":"logs_metrics"}}'
1920
headers:
2021
Connection:
2122
- keep-alive
2223
Content-Length:
23-
- '191'
24+
- '192'
2425
Content-Type:
2526
- application/json;charset=utf-8
2627
Date:
27-
- Fri, 09 Apr 2021 20:21:16 GMT
28+
- Wed, 14 Apr 2021 07:55:33 GMT
2829
cache-control:
2930
- no-cache
3031
content-disposition:
@@ -40,19 +41,19 @@ interactions:
4041
x-content-type-options:
4142
- nosniff
4243
x-dd-debug:
43-
- dPySkcOzIZtKyMKDAAzuysY3gNGGj6RtYogGuSb76E8mPvoqzREyRp6lPYm91hQU
44+
- F5gm0Rce1/Abr9/0Fw8HAqWfiz0FdiH8er/AXnN6lOn3L6KyGgbsLCwgPlob1No8
4445
x-dd-version:
45-
- '35.4280781'
46+
- '35.4306674'
4647
x-frame-options:
4748
- SAMEORIGIN
4849
x-ratelimit-limit:
4950
- '100'
5051
x-ratelimit-period:
5152
- '3600'
5253
x-ratelimit-remaining:
53-
- '82'
54+
- '19'
5455
x-ratelimit-reset:
55-
- '2325'
56+
- '268'
5657
status:
5758
code: 200
5859
message: OK
@@ -66,9 +67,10 @@ interactions:
6667
Dd-Operation-Id:
6768
- DeleteLogsMetric
6869
User-Agent:
69-
- datadog-api-client-python/1.0.0b8.dev29 (python 3.8.8; os Darwin; arch x86_64)
70+
- datadog-api-client-python/1.0.0b8.dev35+dirty (python 3.8.8; os Darwin; arch
71+
x86_64)
7072
method: DELETE
71-
uri: https://api.datadoghq.com/api/v2/logs/config/metrics/Test_Create_a_logbased_metric_returns_OK_response_1617999675
73+
uri: https://api.datadoghq.com/api/v2/logs/config/metrics/Test_Create_a_log_based_metric_returns_OK_response_1618386933
7274
response:
7375
body:
7476
string: '{}'
@@ -80,7 +82,7 @@ interactions:
8082
Content-Type:
8183
- application/json;charset=utf-8
8284
Date:
83-
- Fri, 09 Apr 2021 20:21:16 GMT
85+
- Wed, 14 Apr 2021 07:55:33 GMT
8486
cache-control:
8587
- no-cache
8688
content-disposition:
@@ -94,19 +96,19 @@ interactions:
9496
x-content-type-options:
9597
- nosniff
9698
x-dd-debug:
97-
- l8RQo2maZqJf6GFThBbKNE6dvthz6njusVtau3dPXJWL2RLFoN81H+BLPB/1xgs1
99+
- 5gfwVh/5HZ+AnGd/Di93w3NEWC6KMHT9KzmHEiRJmNdOjBtAsbOcgVFyqEChw71h
98100
x-dd-version:
99-
- '35.4280781'
101+
- '35.4306674'
100102
x-frame-options:
101103
- SAMEORIGIN
102104
x-ratelimit-limit:
103105
- '100'
104106
x-ratelimit-period:
105107
- '3600'
106108
x-ratelimit-remaining:
107-
- '81'
109+
- '18'
108110
x-ratelimit-reset:
109-
- '2324'
111+
- '267'
110112
status:
111113
code: 200
112114
message: OK
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2021-04-09T22:21:04.518094+02:00
1+
2021-04-14T09:55:30.968010+02:00

0 commit comments

Comments
 (0)