@@ -187,74 +187,74 @@ var testBodyMatcherCases = []struct {
187187 shouldMatch bool
188188}{
189189 // create bar compare with foo
190- // {
191- // requestBody: newRequest(http.MethodPost, "https://api.scaleway.com/iam/v1alpha1/users", strings.NewReader(barMemberCreationBody)),
192- // cassetteBody: &cassette.Request{
193- // URL: "https://api.scaleway.com/iam/v1alpha1/users",
194- // Method: http.MethodPost,
195- // Body: fooMemberCreationBody,
196- // ContentLength: int64(len(fooMemberCreationBody)),
197- // },
198- // shouldMatch: false,
199- // },
200- // // create bar compare with bar
201- // {
202- // requestBody: newRequest(http.MethodPost, "https://api.scaleway.com/iam/v1alpha1/users", strings.NewReader(barMemberCreationBody)),
203- // cassetteBody: &cassette.Request{
204- // URL: "https://api.scaleway.com/iam/v1alpha1/users",
205- // Method: http.MethodPost,
206- // Body: barMemberCreationBody,
207- // ContentLength: int64(len(barMemberCreationBody)),
208- // },
209- // shouldMatch: true,
210- // },
211- // // simple http get
212- // {
213- // requestBody: newRequest(http.MethodGet, "https://api.scaleway.com/iam/v1alpha1/users/6867048b-fe12-4e96-835e-41c79a39604b", nil),
214- // cassetteBody: &cassette.Request{
215- // URL: "https://api.scaleway.com/iam/v1alpha1/users/6867048b-fe12-4e96-835e-41c79a39604b",
216- // Method: http.MethodGet,
217- // Body: "",
218- // ContentLength: 0,
219- // },
220- // shouldMatch: true,
221- // },
222- // // patch secret with nested slices of map[string]interface{} in different order
223- // // we cannot user deep equal because the order of the slices is different although the values are the same
224- // // it is not possible to sort them because they are not comparable (map[string]interface{})
225- // {
226- // requestBody: newRequest(http.MethodPatch, "https://api.scaleway.com/secrets/v1/secrets/123", strings.NewReader(secretPatchBodyRequest)),
227- // cassetteBody: &cassette.Request{
228- // URL: "https://api.scaleway.com/secrets/v1/secrets/123",
229- // Method: http.MethodPatch,
230- // Body: secretPatchBodyCassette,
231- // ContentLength: int64(len(secretPatchBodyCassette)),
232- // },
233- // shouldMatch: true,
234- // },
235- // // compare nested slices of different integers
236- // {
237- // requestBody: newRequest(http.MethodPost, "https://api.scaleway.com/iam/v1alpha1/users", strings.NewReader(integertestBodyRequest)),
238- // cassetteBody: &cassette.Request{
239- // URL: "https://api.scaleway.com/iam/v1alpha1/users",
240- // Method: http.MethodPost,
241- // Body: integertestBodyCassette,
242- // ContentLength: int64(len(integertestBodyCassette)),
243- // },
244- // shouldMatch: false,
245- // },
246- // // compare nested slices of same integers in different order
247- // {
248- // requestBody: newRequest(http.MethodPost, "https://api.scaleway.com/iam/v1alpha1/users", strings.NewReader(integerBodyRequestOutOfOrder)),
249- // cassetteBody: &cassette.Request{
250- // URL: "https://api.scaleway.com/iam/v1alpha1/users",
251- // Method: http.MethodPost,
252- // Body: integertestBodyRequest,
253- // ContentLength: int64(len(integertestBodyRequest)),
254- // },
255- // shouldMatch: true,
256- // },
257- // // compare nested slices of slices of strings
190+ {
191+ requestBody : newRequest (http .MethodPost , "https://api.scaleway.com/iam/v1alpha1/users" , strings .NewReader (barMemberCreationBody )),
192+ cassetteBody : & cassette.Request {
193+ URL : "https://api.scaleway.com/iam/v1alpha1/users" ,
194+ Method : http .MethodPost ,
195+ Body : fooMemberCreationBody ,
196+ ContentLength : int64 (len (fooMemberCreationBody )),
197+ },
198+ shouldMatch : false ,
199+ },
200+ // create bar compare with bar
201+ {
202+ requestBody : newRequest (http .MethodPost , "https://api.scaleway.com/iam/v1alpha1/users" , strings .NewReader (barMemberCreationBody )),
203+ cassetteBody : & cassette.Request {
204+ URL : "https://api.scaleway.com/iam/v1alpha1/users" ,
205+ Method : http .MethodPost ,
206+ Body : barMemberCreationBody ,
207+ ContentLength : int64 (len (barMemberCreationBody )),
208+ },
209+ shouldMatch : true ,
210+ },
211+ // simple http get
212+ {
213+ requestBody : newRequest (http .MethodGet , "https://api.scaleway.com/iam/v1alpha1/users/6867048b-fe12-4e96-835e-41c79a39604b" , nil ),
214+ cassetteBody : & cassette.Request {
215+ URL : "https://api.scaleway.com/iam/v1alpha1/users/6867048b-fe12-4e96-835e-41c79a39604b" ,
216+ Method : http .MethodGet ,
217+ Body : "" ,
218+ ContentLength : 0 ,
219+ },
220+ shouldMatch : true ,
221+ },
222+ // patch secret with nested slices of map[string]interface{} in different order
223+ // we cannot user deep equal because the order of the slices is different although the values are the same
224+ // it is not possible to sort them because they are not comparable (map[string]interface{})
225+ {
226+ requestBody : newRequest (http .MethodPatch , "https://api.scaleway.com/secrets/v1/secrets/123" , strings .NewReader (secretPatchBodyRequest )),
227+ cassetteBody : & cassette.Request {
228+ URL : "https://api.scaleway.com/secrets/v1/secrets/123" ,
229+ Method : http .MethodPatch ,
230+ Body : secretPatchBodyCassette ,
231+ ContentLength : int64 (len (secretPatchBodyCassette )),
232+ },
233+ shouldMatch : true ,
234+ },
235+ // compare nested slices of different integers
236+ {
237+ requestBody : newRequest (http .MethodPost , "https://api.scaleway.com/iam/v1alpha1/users" , strings .NewReader (integertestBodyRequest )),
238+ cassetteBody : & cassette.Request {
239+ URL : "https://api.scaleway.com/iam/v1alpha1/users" ,
240+ Method : http .MethodPost ,
241+ Body : integertestBodyCassette ,
242+ ContentLength : int64 (len (integertestBodyCassette )),
243+ },
244+ shouldMatch : false ,
245+ },
246+ // compare nested slices of same integers in different order
247+ {
248+ requestBody : newRequest (http .MethodPost , "https://api.scaleway.com/iam/v1alpha1/users" , strings .NewReader (integerBodyRequestOutOfOrder )),
249+ cassetteBody : & cassette.Request {
250+ URL : "https://api.scaleway.com/iam/v1alpha1/users" ,
251+ Method : http .MethodPost ,
252+ Body : integertestBodyRequest ,
253+ ContentLength : int64 (len (integertestBodyRequest )),
254+ },
255+ shouldMatch : true ,
256+ },
257+ // compare nested slices of slices of strings
258258 {
259259 requestBody : newRequest (http .MethodPost , "https://api.scaleway.com/iam/v1alpha1/users" , strings .NewReader (nestedSliceOfSlicesRequest )),
260260 cassetteBody : & cassette.Request {
0 commit comments