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.
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.
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.
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.
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.
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.
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.
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) |
| 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.
Same here, please leave a bidder request.cur
There was a problem hiding this comment.
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.
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.
Please also add bidderRequest.cur, and same for other.
| price = originalPrice | ||
| ext = new BidExt() | ||
| } | ||
|
|
There was a problem hiding this comment.
Please remove empty line
| def currency = EUR | ||
| def impPrice = PBSUtils.getRandomPrice(MAX_CPM_ADJUST_VALUE) | ||
| def bidRequest = getBidRequestWithFloors(MediaType.BANNER).tap { | ||
| cur = [EUR] |
|
|
||
| then: "Final bid price should be adjusted" | ||
| def bidAdjustedPrice = originalPrice * bidAdjustmentFactorsPrice | ||
| assert !response.ext.warnings |
There was a problem hiding this comment.
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