From fa80289dce9e3c6969c4026a9d386ac5f566130b Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Thu, 23 Jan 2025 18:55:20 +0200 Subject: [PATCH] update functional tests --- .../functional/tests/BidderParamsSpec.groovy | 22 ++++++- .../PriceFloorsCurrencySpec.groovy | 34 ++++++----- .../PriceFloorsFetchingSpec.groovy | 60 ++++++++----------- .../pricefloors/PriceFloorsRulesSpec.groovy | 5 +- .../PriceFloorsSignalingSpec.groovy | 19 +++--- 5 files changed, 78 insertions(+), 62 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy index 6fdc0c8a2d5..0db52ed1a69 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidderParamsSpec.groovy @@ -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 { @@ -832,7 +853,6 @@ class BidderParamsSpec extends BaseSpec { gpid : PBSUtils.randomString, skadn : PBSUtils.randomString, tid : PBSUtils.randomString, - adunitcode : PBSUtils.randomString, (GENERIC.value): genericBidderParams ] } diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy index 786a70a6b86..69d8dce297d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy @@ -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"() { @@ -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"() { @@ -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"() { @@ -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 } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy index 55180fe60d4..a897fbeff7c 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy @@ -418,10 +418,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?.floorProvider == floorsResponse.floorProvider @@ -429,6 +425,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 shouldn't fetch data from provider when use-dynamic-data disabled and useFetchDataRate at max value"() { @@ -999,13 +998,6 @@ 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 @@ -1013,6 +1005,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { 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) @@ -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"() { @@ -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"() { @@ -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 @@ -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"() { @@ -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 @@ -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"() { @@ -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 @@ -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"() { @@ -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 @@ -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"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy index d10f6b07b1b..e493bbb7df9 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy @@ -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"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy index f1385b1649d..72be2f0a0f3 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy @@ -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 @@ -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 @@ -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"() {