Skip to content

Commit

Permalink
Update json test files and Assert ImpIDs after sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-saurabh-narkhede committed Jan 10, 2024
1 parent acbe193 commit c40b264
Show file tree
Hide file tree
Showing 258 changed files with 519 additions and 259 deletions.
6 changes: 4 additions & 2 deletions adapters/adapterstest/test_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"net/http"
"os"
"path/filepath"
"reflect"
"regexp"
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/mitchellh/copystructure"
"github.com/prebid/openrtb/v19/openrtb2"
"github.com/prebid/prebid-server/v2/adapters"
Expand Down Expand Up @@ -325,7 +326,8 @@ func diffHttpRequests(description string, actual *adapters.RequestData, expected
return fmt.Errorf(`expected.ImpIDs must contain at least one imp ID`)
}

if !reflect.DeepEqual(expected.ImpIDs, actual.ImpIDs) {
opt := cmpopts.SortSlices(func(a, b string) bool { return a < b })
if !cmp.Equal(expected.ImpIDs, actual.ImpIDs, opt) {
return fmt.Errorf(`%s actual.ImpIDs "%q" do not match expected "%q"`, description, actual.ImpIDs, expected.ImpIDs)
}
return diffJson(description, actual.Body, expected.Body)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"ip": "123.123.123.123",
"ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
}
}
]
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"device": {
"ip": "123.123.123.123"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"ip": "123.123.123.123",
"ifa": "sdjfksdf-dfsds-dsdg-dsgg"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"bundle": "com.wls.testwlsapplication"
},
"device": {}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"ip": "123.123.123.123",
"ifa": "sdjfksdf-dfsds-dsdg-dsgg"
}
}
},
"impIDs":["test-imp-id"]
},
"expectedBidResponses": [],
"mockResponse": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"ip": "123.123.123.123",
"ifa": "sdjfksdf-dfsds-dsdg-dsgg"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 404,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"ip": "123.123.123.123",
"ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"device": {
"ip": "123.123.123.123"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"ip": "123.123.123.123",
"ifa": "sdjfksdf-dfsds-dsdg-dsgg"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"ip": "123.123.123.123",
"ifa": "sdjfksdf-dfsds-dsdg-dsgg"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 204,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"ip": "123.123.123.123",
"ifa": "sdjfksdf-dfsds-dsdg-dsgg"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 404,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"ip": "123.123.123.123",
"ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx"
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 204,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 418,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@
}
}
}
}
},
"impIDs":["div-gpt-ad-1460505748561-0"]
},
"mockResponse": {
"status": 200,
Expand Down
3 changes: 2 additions & 1 deletion adapters/dianomi/dianomitest/exemplary/multi-format.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
},
"tagid": "9526"
}]
}
},
"impIDs":["test-imp-id-1","test-imp-id-2"]
},
"mockResponse": {
"status": 200,
Expand Down
3 changes: 2 additions & 1 deletion adapters/dianomi/dianomitest/exemplary/multi-native.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
},
"tagid": "9607"
}]
}
},
"impIDs":["test-imp-id-1","test-imp-id-2"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
3 changes: 2 additions & 1 deletion adapters/dianomi/dianomitest/exemplary/single-banner.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
3 changes: 2 additions & 1 deletion adapters/dianomi/dianomitest/exemplary/single-native.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
3 changes: 2 additions & 1 deletion adapters/dianomi/dianomitest/exemplary/single-video.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id","test-imp-id2"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
"w": 1920,
"h": 800
}
}
},
"impIDs":["test-imp-id","test-imp-id2"]
},
"mockResponse": {
"status": 200,
Expand Down
3 changes: 2 additions & 1 deletion adapters/dianomi/dianomitest/supplemental/bad-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
},
"tagid": "9607"
}]
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 400
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
},
"tagid": "9607"
}]
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 204
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
},
"tagid": "12345"
}]
}
},
"impIDs":["test-imp-id","test-imp-id-2"]
},
"mockResponse": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
},
"tagid": "9607"
}]
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
3 changes: 2 additions & 1 deletion adapters/dianomi/dianomitest/supplemental/server-error.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
},
"tagid": "9607"
}]
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
},
"tagid": "9607"
}]
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
Expand Down
Loading

0 comments on commit c40b264

Please sign in to comment.