Skip to content

Commit

Permalink
validateNativeContextTypes function test cases (prebid#1743)
Browse files Browse the repository at this point in the history
  • Loading branch information
guscarreon authored and shunj-nb committed Nov 8, 2022
1 parent 8a213f1 commit 8f9a8bf
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"description": "Native bid request. Context type content (1) is incompatible with 'social' subcontext types (20~29). Return error",
"mockBidRequest": {
"id": "req-id",
"site": {
"page": "some.page.com"
},
"tmax": 500,
"imp": [
{
"id": "some-imp",
"native": {
"request": "{\"context\":1,\"contextsubtype\":21,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
},
"ext": {
"appnexus": {
"placementId": 12883451
}
}
}
]
},
"expectedReturnCode": 400,
"expectedErrorMessage": "Invalid request"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "Native bid request. Context type product (3) is incompatible with 'social' subcontext types (10~19). Return error",
"mockBidRequest": {
"id": "req-id",
"site": {
"page": "some.page.com"
},
"tmax": 500,
"imp": [
{
"id": "some-imp",
"native": {
"request": "{\"context\":3,\"contextsubtype\":11,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
},
"ext": {
"appnexus": {
"placementId": 12883451
}
}
}
]
},
"expectedReturnCode": 400,
"expectedErrorMessage": "Invalid request"
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "Native bid request. Context type social (2) is incompatible with 'product' subcontext types (30~39). Return error",
"mockBidRequest": {
"id": "req-id",
"site": {
"page": "some.page.com"
},
"tmax": 500,
"imp": [
{
"id": "some-imp",
"native": {
"request": "{\"context\":2,\"contextsubtype\":31,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
},
"ext": {
"appnexus": {
"placementId": 12883451
}
}
}
]
},
"expectedReturnCode": 400,
"expectedErrorMessage": "Invalid request"
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"description": "Native bid request comes with a subcontext type greater than 500. Return error",
"mockBidRequest": {
"id": "req-id",
"site": {
"page": "some.page.com"
},
"tmax": 500,
"imp": [
{
"id": "some-imp",
"native": {
"request": "{\"context\":1,\"contextsubtype\":550,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
},
"ext": {
"appnexus": {
"placementId": 12883451
}
}
}
]
},
"expectedReturnCode": 400,
"expectedErrorMessage": "Invalid request"
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "Bid request with invalid contextsubtype value inside the native.request field in its only imp element",
"description": "Native bid request comes with a contextsubtype greater than 32, 'ContextSubTypeProductReview'",
"mockBidRequest": {
"id": "req-id",
"site": {
Expand All @@ -10,7 +10,7 @@
{
"id": "some-imp",
"native": {
"request": "{\"context\":1,\"contextsubtype\":21,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
"request": "{\"context\":1,\"contextsubtype\":41,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
},
"ext": {
"appnexus": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"description": "Native bid request comes with a context type product (3) and compatible subcontext type",
"mockBidRequest": {
"id": "req-id",
"site": {
"page": "some.page.com"
},
"tmax": 500,
"imp": [
{
"id": "some-imp",
"native": {
"request": "{\"context\":3,\"contextsubtype\":31,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
},
"ext": {
"appnexus": {
"placementId": 12883451
}
}
}
]
},
"expectedBidResponse": {
"id": "req-id",
"bidid": "test bid id",
"nbr": 0,
"seatbid": [
{
"bid": [
{
"id": "appnexus-bid",
"impid": "",
"price": 0
}
],
"seat": "appnexus-bids"
}
]
},
"expectedReturnCode": 200
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"description": "Native bid request comes with a context type social (2) and compatible subcontext type",
"mockBidRequest": {
"id": "req-id",
"site": {
"page": "some.page.com"
},
"tmax": 500,
"imp": [
{
"id": "some-imp",
"native": {
"request": "{\"context\":2,\"contextsubtype\":21,\"plcmttype\":1,\"assets\":[{\"title\":{\"len\":90}},{\"img\":{\"hmin\":30,\"wmin\":20}},{\"video\":{\"mimes\":[\"video/mp4\"],\"minduration\":5,\"maxduration\":10,\"protocols\":[1]}},{\"data\":{\"type\":2}}]}"
},
"ext": {
"appnexus": {
"placementId": 12883451
}
}
}
]
},
"expectedBidResponse": {
"id": "req-id",
"bidid": "test bid id",
"nbr": 0,
"seatbid": [
{
"bid": [
{
"id": "appnexus-bid",
"impid": "",
"price": 0
}
],
"seat": "appnexus-bids"
}
]
},
"expectedReturnCode": 200
}

0 comments on commit 8f9a8bf

Please sign in to comment.