Skip to content

Commit 557240b

Browse files
authored
tests: match request body (#406)
1 parent 3a86da6 commit 557240b

File tree

138 files changed

+1474
-1441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+1474
-1441
lines changed

tests/api/v1/datadog/api_organizations_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ func TestOrgsUploadIdpErrors(t *testing.T) {
362362
assert := tests.Assert(ctx, t)
363363

364364
_, httpresp, err := Client(ctx).OrganizationsApi.UploadIdPForOrg(ctx, "lsqdkjf").IdpFile(file).Execute()
365+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
365366
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
366367
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
367368
assert.True(ok)

tests/api/v1/datadog/api_synthetics_test.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func getTestSyntheticsAPI(ctx context.Context, t *testing.T) datadog.SyntheticsT
3737
targetJSONPath := datadog.NewSyntheticsAssertionJSONPathTarget(datadog.SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH, datadog.SYNTHETICSASSERTIONTYPE_BODY)
3838
targetJSONPath.SetTarget(
3939
datadog.SyntheticsAssertionJSONPathTargetTarget{
40-
JsonPath: datadog.PtrString("topKey"),
41-
Operator: datadog.PtrString("isNot"),
40+
JsonPath: datadog.PtrString("topKey"),
41+
Operator: datadog.PtrString("isNot"),
4242
TargetValue: &targetValue0,
4343
},
4444
)
@@ -647,11 +647,13 @@ func TestSyntheticsDeleteTest404Error(t *testing.T) {
647647
func TestSyntheticsUpdateStatusTestErrors(t *testing.T) {
648648
ctx, finish := WithRecorder(WithTestAuth(context.Background()), t)
649649
defer finish()
650+
assert := tests.Assert(ctx, t)
650651

651652
// Create API test
652653
testSyntheticsAPI := getTestSyntheticsAPI(ctx, t)
653654
syntAPI, _, err := Client(ctx).SyntheticsApi.CreateTest(ctx).Body(testSyntheticsAPI).Execute()
654655
if err != nil {
656+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
655657
t.Fatalf("Error creating Synthetics test %v: Response %s: %v", testSyntheticsAPI, err.(datadog.GenericOpenAPIError).Body(), err)
656658
}
657659
publicIDAPI := syntAPI.GetPublicId()
@@ -674,6 +676,7 @@ func TestSyntheticsUpdateStatusTestErrors(t *testing.T) {
674676
assert := tests.Assert(ctx, t)
675677

676678
_, httpresp, err := Client(ctx).SyntheticsApi.UpdateTestPauseStatus(ctx, tc.ID).Body(datadog.SyntheticsUpdateTestPauseStatusPayload{}).Execute()
679+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
677680
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
678681
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
679682
assert.True(ok)
@@ -702,6 +705,7 @@ func TestSyntheticsBrowserResultsErrors(t *testing.T) {
702705
assert := tests.Assert(ctx, t)
703706

704707
_, httpresp, err := Client(ctx).SyntheticsApi.GetBrowserTestLatestResults(ctx, tc.ID).Execute()
708+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
705709
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
706710
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
707711
assert.True(ok)
@@ -730,6 +734,7 @@ func TestSyntheticsGetAPIResultsErrors(t *testing.T) {
730734
assert := tests.Assert(ctx, t)
731735

732736
_, httpresp, err := Client(ctx).SyntheticsApi.GetAPITestLatestResults(ctx, tc.ID).Execute()
737+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
733738
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
734739
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
735740
assert.True(ok)
@@ -758,6 +763,7 @@ func TestSyntheticsBrowserSpecificResultErrors(t *testing.T) {
758763
assert := tests.Assert(ctx, t)
759764

760765
_, httpresp, err := Client(ctx).SyntheticsApi.GetBrowserTestResult(ctx, tc.ID, "resultid").Execute()
766+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
761767
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
762768
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
763769
assert.True(ok)
@@ -786,6 +792,7 @@ func TestSyntheticsGetAPISpecificResultErrors(t *testing.T) {
786792
assert := tests.Assert(ctx, t)
787793

788794
_, httpresp, err := Client(ctx).SyntheticsApi.GetAPITestResult(ctx, tc.ID, "resultid").Execute()
795+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
789796
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
790797
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
791798
assert.True(ok)
@@ -814,6 +821,7 @@ func TestSyntheticsGetTestErrors(t *testing.T) {
814821
assert := tests.Assert(ctx, t)
815822

816823
_, httpresp, err := Client(ctx).SyntheticsApi.GetTest(ctx, tc.ID).Execute()
824+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
817825
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
818826
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
819827
assert.True(ok)
@@ -853,6 +861,7 @@ func TestSyntheticsUpdateTestErrors(t *testing.T) {
853861
assert := tests.Assert(ctx, t)
854862

855863
_, httpresp, err := Client(ctx).SyntheticsApi.UpdateTest(ctx, tc.ID).Body(datadog.SyntheticsTestDetails{}).Execute()
864+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
856865
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
857866
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
858867
assert.True(ok)
@@ -880,6 +889,7 @@ func TestSyntheticsListTestErrors(t *testing.T) {
880889
assert := tests.Assert(ctx, t)
881890

882891
_, httpresp, err := Client(ctx).SyntheticsApi.ListTests(ctx).Execute()
892+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
883893
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
884894
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
885895
assert.True(ok)
@@ -929,6 +939,7 @@ func TestSyntheticsCreateTestErrors(t *testing.T) {
929939
assert := tests.Assert(ctx, t)
930940

931941
_, httpresp, err := Client(ctx).SyntheticsApi.CreateTest(ctx).Body(datadog.SyntheticsTestDetails{}).Execute()
942+
assert.IsType(datadog.GenericOpenAPIError{}, err, "%v", err)
932943
assert.Equal(tc.ExpectedStatusCode, httpresp.StatusCode)
933944
apiError, ok := err.(datadog.GenericOpenAPIError).Model().(datadog.APIErrorResponse)
934945
assert.True(ok)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2020-05-12T15:33:10.18986+02:00
1+
2020-07-24T11:17:48.545168+02:00

tests/api/v1/datadog/cassettes/TestOrgsUploadIdpErrors/400_Bad_Request.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
version: 1
33
interactions:
44
- request:
5-
body: "--1d76693157d37a63a8836fcbd87e6eb6b0f1b3a81a02d850108b6851ddc3\r\nContent-Disposition:
5+
body: "--e2bc4649cd0f9222fa92f297e5d3b0521250329fa1e6b5aacb111f4a4d29\r\nContent-Disposition:
66
form-data; name=\"idp_file\"; filename=\"error_415.json\"\r\nContent-Type: application/octet-stream\r\n\r\n{\"errors\":
7-
[\"Attempt to upload idp metadata with an unsupported Content-Type\"]}\n\r\n--1d76693157d37a63a8836fcbd87e6eb6b0f1b3a81a02d850108b6851ddc3--\r\n"
7+
[\"Attempt to upload idp metadata with an unsupported Content-Type\"]}\n\r\n--e2bc4649cd0f9222fa92f297e5d3b0521250329fa1e6b5aacb111f4a4d29--\r\n"
88
form: {}
99
headers:
1010
Accept:
1111
- application/json
1212
Content-Length:
1313
- "262"
1414
Content-Type:
15-
- multipart/form-data; boundary=1d76693157d37a63a8836fcbd87e6eb6b0f1b3a81a02d850108b6851ddc3
15+
- multipart/form-data; boundary=e2bc4649cd0f9222fa92f297e5d3b0521250329fa1e6b5aacb111f4a4d29
1616
Dd-Operation-Id:
1717
- UploadIdPForOrg
1818
User-Agent:
19-
- datadog-api-client-go/1.0.0-beta.2 (go go1.14; os darwin; arch amd64)
19+
- datadog-api-client-go/1.0.0-beta.8+dev (go go1.14.3; os darwin; arch amd64)
2020
X-Datadog-Parent-Id:
21-
- "6256725549008361374"
21+
- "4025874573951428686"
2222
X-Datadog-Sampling-Priority:
2323
- "1"
2424
X-Datadog-Trace-Id:
25-
- "8867440071354334626"
25+
- "8747455412557228266"
2626
url: https://api.datadoghq.com/api/v1/org/lsqdkjf/idp_metadata
2727
method: POST
2828
response:
@@ -34,12 +34,10 @@ interactions:
3434
- keep-alive
3535
Content-Length:
3636
- "55"
37-
Content-Security-Policy:
38-
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
3937
Content-Type:
4038
- application/json
4139
Date:
42-
- Tue, 12 May 2020 13:33:10 GMT
40+
- Fri, 24 Jul 2020 09:17:51 GMT
4341
Dd-Pool:
4442
- dogweb_wallace
4543
Pragma:
@@ -49,7 +47,7 @@ interactions:
4947
X-Content-Type-Options:
5048
- nosniff
5149
X-Dd-Version:
52-
- "35.2492943"
50+
- "35.2781855"
5351
X-Frame-Options:
5452
- SAMEORIGIN
5553
status: 400 Bad Request
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2020-05-12T15:33:11.011561+02:00
1+
2020-07-24T11:17:51.210677+02:00

tests/api/v1/datadog/cassettes/TestOrgsUploadIdpErrors/403_Forbidden.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ interactions:
1212
Dd-Operation-Id:
1313
- UploadIdPForOrg
1414
User-Agent:
15-
- datadog-api-client-go/1.0.0-beta.2 (go go1.14; os darwin; arch amd64)
15+
- datadog-api-client-go/1.0.0-beta.8+dev (go go1.14.3; os darwin; arch amd64)
1616
X-Datadog-Parent-Id:
17-
- "1207966146453958355"
17+
- "2616175331127997705"
1818
X-Datadog-Sampling-Priority:
1919
- "1"
2020
X-Datadog-Trace-Id:
21-
- "8867440071354334626"
21+
- "8747455412557228266"
2222
url: https://api.datadoghq.com/api/v1/org/lsqdkjf/idp_metadata
2323
method: POST
2424
response:
@@ -32,7 +32,7 @@ interactions:
3232
Content-Type:
3333
- application/json
3434
Date:
35-
- Tue, 12 May 2020 13:33:11 GMT
35+
- Fri, 24 Jul 2020 09:17:51 GMT
3636
Via:
3737
- 1.1 haproxy
3838
status: 403 Forbidden
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2020-07-10T10:49:49.884744+02:00
1+
2020-07-24T11:28:42.39833+02:00

tests/api/v1/datadog/cassettes/TestScenarios/Feature_IP_Ranges/Scenario_List_IP_Ranges_returns__OK__response.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ interactions:
1010
Dd-Operation-Id:
1111
- GetIPRanges
1212
User-Agent:
13-
- datadog-api-client-go/1.0.0-beta.7+dev (go go1.14.3; os darwin; arch amd64)
13+
- datadog-api-client-go/1.0.0-beta.8+dev (go go1.14.3; os darwin; arch amd64)
1414
X-Datadog-Parent-Id:
15-
- "703337467988536674"
15+
- "4007669915041302745"
1616
X-Datadog-Sampling-Priority:
1717
- "1"
1818
X-Datadog-Trace-Id:
19-
- "1585589616748263641"
19+
- "7745952772947156856"
2020
url: https://ip-ranges.datadoghq.com/
2121
method: GET
2222
response:
@@ -912,21 +912,21 @@ interactions:
912912
Content-Type:
913913
- application/json
914914
Date:
915-
- Fri, 10 Jul 2020 08:49:51 GMT
915+
- Fri, 24 Jul 2020 09:28:43 GMT
916916
Last-Modified:
917917
- Mon, 22 Jun 2020 10:05:14 GMT
918918
Server:
919919
- AmazonS3
920920
Vary:
921921
- Accept-Encoding
922922
Via:
923-
- 1.1 713e5c81a0f7ad564b97cf451e92aaac.cloudfront.net (CloudFront)
923+
- 1.1 803bb8de3c7a92b10030fcaaf02a53d3.cloudfront.net (CloudFront)
924924
X-Amz-Cf-Id:
925-
- lPqOi1TJ3Jx5YiGN3eYzzZqycPgj9JBJ0W7Tt2aD4At79Rd_SwWULQ==
925+
- 0s3WNQtLp7Gckik8qWcHF0jJfjXf-sDSqylGjbwx7djhuvloBSBmIQ==
926926
X-Amz-Cf-Pop:
927927
- MAD50-C1
928928
X-Cache:
929-
- RefreshHit from cloudfront
929+
- Miss from cloudfront
930930
status: 200 OK
931931
code: 200
932932
duration: ""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2020-06-29T09:53:52.549447+02:00
1+
2020-07-24T11:33:25.310183+02:00

0 commit comments

Comments
 (0)