-
Notifications
You must be signed in to change notification settings - Fork 749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validateNativeContextTypes function test cases #1743
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...ts/openrtb2/sample-requests/invalid-native/context-type-content-incompatible-subtype.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
27 changes: 27 additions & 0 deletions
27
...ts/openrtb2/sample-requests/invalid-native/context-type-product-incompatible-subtype.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
|
||
|
27 changes: 27 additions & 0 deletions
27
...nts/openrtb2/sample-requests/invalid-native/context-type-social-incompatible-subtype.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
|
||
|
26 changes: 26 additions & 0 deletions
26
endpoints/openrtb2/sample-requests/invalid-native/contextsubtype-greater-than-max.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
endpoints/openrtb2/sample-requests/valid-native/context-product-compatible-subtype.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
41 changes: 41 additions & 0 deletions
41
endpoints/openrtb2/sample-requests/valid-native/context-social-compatible-subtype.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the error messages returned in the
validateNativeContextTypes
method to be different that what is expected in these tests. Is the error message getting overridden somewhere to this?? If so, they shouldn't be as the error messages in thevalidateNativeContextTypes
are more informative of the problemThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed this as well but I played with one of the tests a bit and saw that the actual error message returned by
validateNativeContextTypes
hasInvalid Request:
prepended to it and the test framework is just checking that the error message begins with whateverexpectedErrorMessage
is rather than doing a full string compare.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly