-
Notifications
You must be signed in to change notification settings - Fork 224
Tests: adjust floors for bidadjustments #3868
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
Tests: adjust floors for bidadjustments #3868
Conversation
…ional-tests/adjust-floors
…ional-tests/adjust-floors
| def response = pbsService.sendAuctionRequest(bidRequest) | ||
|
|
||
| then: "Final bid price should be adjusted for big with dealId" | ||
| response.seatbid.first.bid.find { it.dealid == dealId } |
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.
Why removed?
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.
It's dead code that does nothing
| seatbid.first.bid.first.price = originalPrice | ||
| seatbid.first.bid.first.dealid = dealId | ||
| } | ||
| } as BidResponse |
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.
Do we need as BidResponse?
| and: "Bidder request should contain currency from request" | ||
| and: "Bidder request should contain original imp.floors" | ||
| def bidderRequest = bidder.getBidderRequest(bidRequest.id) | ||
| assert bidderRequest.cur == [currency] |
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.
Why currency assert removed?
| private static final Integer MAX_STATIC_ADJUST_VALUE = Integer.MAX_VALUE | ||
| private static final String WILDCARD = '*' | ||
|
|
||
| private static final Map config = CURRENCY_CONVERTER_CONFIG + |
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.
Please rename the config to PBS_CONFIG
| STATIC | PBSUtils.getRandomPrice(MAX_CPM_ADJUST_VALUE, MAX_STATIC_ADJUST_VALUE) | ANY | getBidRequestWithFloors(MediaType.BANNER) | ||
| } | ||
|
|
||
| def "PBS should left original bidderRequest with null floors when request has bidAdjustments config"() { |
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.
Looks like It's a similar test to PBS should adjust bid price for matching bidder and left original bidderRequest with null floors when request has bidAdjustments config
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.
In most cases, they are similar, but for floors, you have floors config enabled and floors specified inside request
| private static BidRequest getDefaultVideoRequestWithPlacement(VideoPlacementSubtypes videoPlacementSubtypes) { | ||
| getBidRequestWithFloors(MediaType.VIDEO).tap { | ||
| imp.first.video.tap { | ||
| placement = videoPlacementSubtypes | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private static BidRequest getDefaultVideoRequestWithPlcmt(VideoPlcmtSubtype videoPlcmtSubtype) { | ||
| getBidRequestWithFloors(MediaType.VIDEO).tap { | ||
| imp.first.video.tap { | ||
| plcmt = videoPlcmtSubtype | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private static BidRequest getDefaultVideoRequestWithPlcmtAndPlacement(VideoPlcmtSubtype videoPlcmtSubtype, | ||
| VideoPlacementSubtypes videoPlacementSubtypes) { | ||
| getBidRequestWithFloors(MediaType.VIDEO).tap { | ||
| imp.first.video.tap { | ||
| plcmt = videoPlcmtSubtype | ||
| placement = videoPlacementSubtypes | ||
| } | ||
| } | ||
| } |
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.
private static BidRequest getDefaultVideoRequestWithPlacement(VideoPlacementSubtypes videoPlacementSubtypes) {
getDefaultVideoRequestWithPlcmtAndPlacement(null, videoPlacementSubtypes)
}
private static BidRequest getDefaultVideoRequestWithPlcmt(VideoPlcmtSubtype videoPlcmtSubtype) {
getDefaultVideoRequestWithPlcmtAndPlacement(videoPlcmtSubtype, null)
}
private static BidRequest getDefaultVideoRequestWithPlcmtAndPlacement(VideoPlcmtSubtype videoPlcmtSubtype,
VideoPlacementSubtypes videoPlacementSubtypes) {
getBidRequestWithFloors(MediaType.VIDEO).tap {
imp.first.video.tap {
plcmt = videoPlcmtSubtype
placement = videoPlacementSubtypes
}
}
}
| and: "Default bid response with JPY currency" | ||
| def originalPrice = PBSUtils.randomDecimal | ||
| def bidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { | ||
| cur = USD | ||
| seatbid.first.bid.first.price = originalPrice | ||
| } | ||
| bidder.setResponse(bidRequest.id, bidResponse) |
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.
Wrong description
| and: "Bidder request should contain default currency" | ||
| and: "Bidder request should contain original imp.floors" | ||
| def bidderRequest = bidder.getBidderRequest(bidRequest.id) | ||
| assert bidderRequest.cur == [currency] |
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.
Same here, please leave a bidder request.cur
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.
Please check another cases
| cur = currency | ||
| seatbid.first.bid.first.price = originalPrice | ||
| seatbid.first.bid.first.dealid = PBSUtils.randomString | ||
| } as BidResponse |
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 think it isn't needed, same for others
|
|
||
| and: "Bidder request should contain reversed imp.floors" | ||
| def bidderRequest = bidder.getBidderRequest(bidRequest.id) | ||
| assert bidderRequest.imp.bidFloorCur == [currency, currency] |
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.
Please also add bidderRequest.cur, and same for other.
| price = originalPrice | ||
| ext = new BidExt() | ||
| } | ||
|
|
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.
Please remove empty line
| def currency = EUR | ||
| def impPrice = PBSUtils.getRandomPrice(MAX_CPM_ADJUST_VALUE) | ||
| def bidRequest = getBidRequestWithFloors(MediaType.BANNER).tap { | ||
| cur = [EUR] |
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.
Minor: cur = [currency]
|
|
||
| then: "Final bid price should be adjusted" | ||
| def bidAdjustedPrice = originalPrice * bidAdjustmentFactorsPrice | ||
| assert !response.ext.warnings |
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.
Please add new and: block for warning and errors
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check