Skip to content

Commit

Permalink
update functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
osulzhenko committed Jan 23, 2025
1 parent 121cf50 commit fa80289
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,27 @@ class BidderParamsSpec extends BaseSpec {
"request.imp[0].ext.prebid.bidder contains unknown bidder: anyUnsupportedBidder"]
}

def "PBS should emit warning and proceed auction when ext.prebid fields include adunitcode"() {
given: "Default bid request with populated ext.prebid.bidderParams"
def genericBidderParams = PBSUtils.randomString
def bidRequest = BidRequest.defaultBidRequest.tap {
ext.prebid.bidderParams = [adUnitCode : PBSUtils.randomString,
(GENERIC.value): genericBidderParams]
}

when: "PBS processes auction request"
def response = defaultPbsService.sendAuctionRequest(bidRequest)

then: "Response shouldn't contain error"
assert !response.ext?.errors

and: "PBS should emit an warning"
assert response?.ext?.warnings[PREBID]*.code == [999]
assert response?.ext?.warnings[PREBID]*.message ==
["WARNING: request.imp[0].ext.prebid.bidder.adUnitCode was dropped with a reason: " +
"request.imp[0].ext.prebid.bidder contains unknown bidder: adUnitCode"]
}

def "PBS shouldn't emit warning and proceed auction when all imp.ext fields known for PBS"() {
given: "Default bid request with populated imp.ext"
def impExt = ImpExt.getDefaultImpExt().tap {
Expand Down Expand Up @@ -832,7 +853,6 @@ class BidderParamsSpec extends BaseSpec {
gpid : PBSUtils.randomString,
skadn : PBSUtils.randomString,
tid : PBSUtils.randomString,
adunitcode : PBSUtils.randomString,
(GENERIC.value): genericBidderParams
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,14 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec {
currencyFloorsPbsService.sendAuctionRequest(bidRequest)

then: "Bidder request should contain floorMin, floorMinCur, currency from request"
verifyAll(bidder.getBidderRequest(bidRequest.id)) {
imp[0].ext.prebid.floors.floorMinCur == EUR
imp[0].ext.prebid.floors.floorMin == FLOOR_MIN
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
verifyAll(bidderRequest) {
ext.prebid.floors.floorMinCur == EUR
ext.prebid.floors.floorMin == FLOOR_MIN
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should return warning when both floorMinCur and floorMinCur exist and they're different"() {
Expand All @@ -445,12 +447,14 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec {
["imp[].ext.prebid.floors.floorMinCur and ext.prebid.floors.floorMinCur has different values"]

and: "Bidder request should contain floorMinCur, floorMin from request"
verifyAll(bidder.getBidderRequest(bidRequest.id)) {
imp[0].ext.prebid.floors.floorMinCur == EUR
imp[0].ext.prebid.floors.floorMin == FLOOR_MIN
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
verifyAll(bidderRequest) {
ext.prebid.floors.floorMinCur == JPY
ext.prebid.floors.floorMin == FLOOR_MIN
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should choose floorMin from imp[0].ext.prebid.floors when imp[0].ext.prebid.floors is present"() {
Expand All @@ -470,13 +474,14 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec {
currencyFloorsPbsService.sendAuctionRequest(bidRequest)

then: "Bidder request should contain floorMin, floorValue, bidFloor, bidFloorCur"
verifyAll(bidder.getBidderRequest(bidRequest.id)) {
imp[0].ext.prebid.floors.floorMinCur == USD
imp[0].ext.prebid.floors.floorMin == impExtPrebidFloorMin
imp[0].ext.prebid.floors.floorValue == impExtPrebidFloorMin
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
verifyAll(bidderRequest) {
imp[0].bidFloor == impExtPrebidFloorMin
imp[0].bidFloorCur == USD
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should choose floorMin from ext.prebid.floors when imp[0].ext.prebid.floor.floorMin is absent"() {
Expand All @@ -495,12 +500,13 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec {
currencyFloorsPbsService.sendAuctionRequest(bidRequest)

then: "Bidder request should contain bidFloorCur, bidFloor, floorValue"
verifyAll(bidder.getBidderRequest(bidRequest.id)) {
!imp[0].ext.prebid.floors.floorMinCur
!imp[0].ext.prebid.floors.floorMin
imp[0].ext.prebid.floors.floorValue == extPrebidFloorMin
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
verifyAll(bidderRequest) {
imp[0].bidFloor == extPrebidFloorMin
imp[0].bidFloorCur == USD
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,16 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
imp[0].bidFloor == floorValue
imp[0].bidFloorCur == floorsResponse.modelGroups[0].currency

imp[0].ext?.prebid?.floors?.floorRule == floorsResponse.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue == floorValue
imp[0].ext?.prebid?.floors?.floorValue == floorValue

ext?.prebid?.floors?.location == FETCH
ext?.prebid?.floors?.fetchStatus == SUCCESS
ext?.prebid?.floors?.floorProvider == floorsResponse.floorProvider

ext?.prebid?.floors?.skipRate == floorsResponse.skipRate
ext?.prebid?.floors?.data == floorsResponse
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS shouldn't fetch data from provider when use-dynamic-data disabled and useFetchDataRate at max value"() {
Expand Down Expand Up @@ -999,20 +998,16 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
imp[0].bidFloor == storedRequestModel.ext.prebid.floors.data.modelGroups[0].values[rule]
imp[0].bidFloorCur == storedRequestModel.ext.prebid.floors.data.modelGroups[0].currency

imp[0].ext?.prebid?.floors?.floorRule ==
storedRequestModel.ext.prebid.floors.data.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue ==
storedRequestModel.ext.prebid.floors.data.modelGroups[0].values[rule]
imp[0].ext?.prebid?.floors?.floorValue ==
storedRequestModel.ext.prebid.floors.data.modelGroups[0].values[rule]

ext?.prebid?.floors?.location == REQUEST
ext?.prebid?.floors?.fetchStatus == NONE
ext?.prebid?.floors?.floorMin == storedRequestModel.ext.prebid.floors.floorMin
ext?.prebid?.floors?.floorProvider == storedRequestModel.ext.prebid.floors.data.floorProvider
ext?.prebid?.floors?.data == storedRequestModel.ext.prebid.floors.data
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors

where:
request | bidRequestWithFloors
BidRequest.defaultBidRequest | getBidRequestWithFloors(SITE)
Expand Down Expand Up @@ -1044,16 +1039,15 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
imp[0].bidFloor == bidRequest.ext.prebid.floors.data.modelGroups[0].values[rule]
imp[0].bidFloorCur == bidRequest.ext.prebid.floors.data.modelGroups[0].currency

imp[0].ext?.prebid?.floors?.floorRule == bidRequest.ext.prebid.floors.data.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue == bidRequest.ext.prebid.floors.data.modelGroups[0].values[rule]
imp[0].ext?.prebid?.floors?.floorValue == bidRequest.ext.prebid.floors.data.modelGroups[0].values[rule]

ext?.prebid?.floors?.location == REQUEST
ext?.prebid?.floors?.fetchStatus == NONE
ext?.prebid?.floors?.floorMin == bidRequest.ext.prebid.floors.floorMin
ext?.prebid?.floors?.floorProvider == bidRequest.ext.prebid.floors.data.floorProvider
ext?.prebid?.floors?.data == bidRequest.ext.prebid.floors.data
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should prefer data from stored request when fetch is disabled in account config for amp request"() {
Expand All @@ -1080,19 +1074,15 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
imp[0].bidFloor == ampStoredRequest.ext.prebid.floors.data.modelGroups[0].values[rule]
imp[0].bidFloorCur == ampStoredRequest.ext.prebid.floors.data.modelGroups[0].currency

imp[0].ext?.prebid?.floors?.floorRule ==
ampStoredRequest.ext.prebid.floors.data.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue ==
ampStoredRequest.ext.prebid.floors.data.modelGroups[0].values[rule]
imp[0].ext?.prebid?.floors?.floorValue ==
ampStoredRequest.ext.prebid.floors.data.modelGroups[0].values[rule]

ext?.prebid?.floors?.location == REQUEST
ext?.prebid?.floors?.fetchStatus == NONE
ext?.prebid?.floors?.floorMin == ampStoredRequest.ext.prebid.floors.floorMin
ext?.prebid?.floors?.floorProvider == ampStoredRequest.ext.prebid.floors.data.floorProvider
ext?.prebid?.floors?.data == ampStoredRequest.ext.prebid.floors.data
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should prefer data from floors provider when floors data is defined in both request and stored request"() {
Expand Down Expand Up @@ -1130,10 +1120,6 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
imp[0].bidFloor == floorValue
imp[0].bidFloorCur == floorsResponse.modelGroups[0].currency

imp[0].ext?.prebid?.floors?.floorRule == floorsResponse.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue == floorValue
imp[0].ext?.prebid?.floors?.floorValue == floorValue

ext?.prebid?.floors?.location == FETCH
ext?.prebid?.floors?.fetchStatus == SUCCESS
ext?.prebid?.floors?.floorMin == bidRequest.ext.prebid.floors.floorMin
Expand All @@ -1142,6 +1128,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
ext?.prebid?.floors?.skipRate == floorsResponse.skipRate
ext?.prebid?.floors?.data == floorsResponse
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should prefer data from floors provider when floors data is defined in stored request for amp request"() {
Expand Down Expand Up @@ -1175,10 +1164,6 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
imp[0].bidFloor == floorValue
imp[0].bidFloorCur == floorsResponse.modelGroups[0].currency

imp[0].ext?.prebid?.floors?.floorRule == floorsResponse.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue == floorValue
imp[0].ext?.prebid?.floors?.floorValue == floorValue

ext?.prebid?.floors?.location == FETCH
ext?.prebid?.floors?.fetchStatus == SUCCESS
ext?.prebid?.floors?.floorMin == ampStoredRequest.ext.prebid.floors.floorMin
Expand All @@ -1187,6 +1172,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
ext?.prebid?.floors?.skipRate == floorsResponse.skipRate
ext?.prebid?.floors?.data == floorsResponse
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should periodically fetch floor rules when previous response from floors provider is #description"() {
Expand Down Expand Up @@ -1260,9 +1248,6 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
verifyAll(bidderRequest) {
imp[0].bidFloor == floorValue
imp[0].bidFloorCur == floorsResponse.modelGroups[0].currency
imp[0].ext?.prebid?.floors?.floorRule == floorsResponse.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue == floorValue
imp[0].ext?.prebid?.floors?.floorValue == floorValue

ext?.prebid?.floors?.location == FETCH
ext?.prebid?.floors?.fetchStatus == SUCCESS
Expand All @@ -1272,6 +1257,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
ext?.prebid?.floors?.skipRate == floorsResponse.skipRate
ext?.prebid?.floors?.data == floorsResponse
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should validate rules from request when floorMin from request is invalid"() {
Expand Down Expand Up @@ -1622,9 +1610,6 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
verifyAll(bidderRequest) {
imp[0].bidFloor == floorValue
imp[0].bidFloorCur == floorsResponse.modelGroups[0].currency
imp[0].ext?.prebid?.floors?.floorRule == floorsResponse.modelGroups[0].values.keySet()[0]
imp[0].ext?.prebid?.floors?.floorRuleValue == floorValue
imp[0].ext?.prebid?.floors?.floorValue == floorValue

ext?.prebid?.floors?.location == FETCH
ext?.prebid?.floors?.fetchStatus == SUCCESS
Expand All @@ -1634,6 +1619,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec {
ext?.prebid?.floors?.skipRate == floorsResponse.skipRate
ext?.prebid?.floors?.data == floorsResponse
}

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should reject fetch when modelWeight from floors provider is invalid"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec {
then: "Bidder request bidFloor should correspond to appropriate rule"
def bidderRequest = bidder.getBidderRequests(bidRequest.id).last()
assert bidderRequest.imp[0].bidFloor == floorValue
assert bidderRequest.imp[0].ext.prebid.floors.floorRule == rule
assert bidderRequest.imp[0].ext.prebid.floors.floorRuleValue == floorValue

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should support different delimiters for floor rules"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,10 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec {

then: "Bidder request bidFloor should be update according to bidAdjustment"
def bidderRequest = bidder.getBidderRequests(bidRequest.id).last()
verifyAll(bidderRequest) {
imp[0].bidFloor == floorsProviderFloorValue / bidAdjustment
imp[0].ext.prebid.floors.floorRuleValue == floorsProviderFloorValue
imp[0].ext.prebid.floors.floorValue == imp[0].bidFloor
}
assert bidderRequest.imp[0].bidFloor == floorsProviderFloorValue / bidAdjustment

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors

where:
pbsConfigBidAdjustmentFlag | requestBidAdjustmentFlag | accountBidAdjustmentFlag
Expand Down Expand Up @@ -412,8 +411,9 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec {
then: "Bidder request bidFloor should be changed"
def bidderRequest = bidder.getBidderRequests(bidRequest.id).last()
assert bidderRequest.imp[0].bidFloor == floorsProviderFloorValue
assert bidderRequest.imp[0].ext.prebid.floors.floorRuleValue == floorsProviderFloorValue
assert bidderRequest.imp[0].ext.prebid.floors.floorValue == floorsProviderFloorValue

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors

where:
pbsConfigBidAdjustmentFlagSnakeCase | pbsConfigBidAdjustmentFlag | requestBidAdjustmentFlag | accountBidAdjustmentFlag | accountBidAdjustmentFlagSnakeCase
Expand Down Expand Up @@ -454,8 +454,9 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec {
then: "Bidder request bidFloor should be update according to bidAdjustment"
def bidderRequest = bidder.getBidderRequests(bidRequest.id).last()
assert bidderRequest.imp[0].bidFloor == getAdjustedValue(floorValue, bidAdjustment)
assert bidderRequest.imp[0].ext.prebid.floors.floorRuleValue == floorValue
assert bidderRequest.imp[0].ext.prebid.floors.floorValue == bidderRequest.imp[0].bidFloor

and: "Bidder request shouldn't include imp.ext.prebid.floors"
assert !bidderRequest.imp[0].ext.prebid.floors
}

def "PBS should remove non-selected models"() {
Expand Down

0 comments on commit fa80289

Please sign in to comment.