Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ImpExtPrebid {
ImpExtPrebidFloors floors
Map passThrough
Map<BidderName, Imp> imp
@JsonProperty("adunitcode")
String adUnitCode

static ImpExtPrebid getDefaultImpExtPrebid() {
new ImpExtPrebid().tap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Prebid {
List<MultiBid> multibid
Pbs pbs
Server server
Map<BidderName, Map<String, Integer>> bidderParams
Map bidderParams
ExtPrebidFloors floors
Map passThrough
Events events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ class BidderParamsSpec extends BaseSpec {
given: "Default bid request with populated imp.ext"
def impExt = ImpExt.getDefaultImpExt().tap {
prebid.bidder.generic = null
prebid.adUnitCode = PBSUtils.randomString
generic = new Generic()
ae = PBSUtils.randomNumber
all = PBSUtils.randomNumber
Expand All @@ -795,9 +796,15 @@ class BidderParamsSpec extends BaseSpec {
}

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

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

then: "Bidder request should contain same field as requested"
and: "Response shouldn't contain warning"
assert !response.ext?.warnings

and: "Bidder request should contain same field as requested"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
verifyAll(bidderRequest.imp[0].ext) {
bidder == impExt.generic
Expand All @@ -809,7 +816,39 @@ class BidderParamsSpec extends BaseSpec {
gpid == impExt.gpid
skadn == impExt.skadn
tid == impExt.tid
prebid.adUnitCode == impExt.prebid.adUnitCode
}
}

def "PBS should proceed auction without warning when all ext.prebid.bidderParams fields are known"() {
given: "Default bid request with populated ext.prebid.bidderParams"
def genericBidderParams = PBSUtils.randomString
def bidRequest = BidRequest.defaultBidRequest.tap {
ext.prebid.bidderParams = [ae : PBSUtils.randomString,
all : PBSUtils.randomString,
context : PBSUtils.randomString,
data : PBSUtils.randomString,
general : PBSUtils.randomString,
gpid : PBSUtils.randomString,
skadn : PBSUtils.randomString,
tid : PBSUtils.randomString,
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: "Response shouldn't contain warning"
assert !response.ext?.warnings

and: "Bidder request should bidderParams only for bidder"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.ext.prebid.bidderParams == [(GENERIC.value): genericBidderParams]
}

def "PBS should send request to bidder when adapters.bidder.meta-info.currency-accepted not specified"() {
Expand Down Expand Up @@ -847,7 +886,7 @@ class BidderParamsSpec extends BaseSpec {
def "PBS should send request to bidder when adapters.bidder.aliases.bidder.meta-info.currency-accepted not specified"() {
given: "PBS with adapter configuration"
def pbsService = pbsServiceFactory.getService(
"adapters.generic.aliases.alias.enabled" : "true",
"adapters.generic.aliases.alias.enabled": "true",
"adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString(),
"adapters.generic.aliases.alias.meta-info.currency-accepted": "")

Expand Down Expand Up @@ -955,7 +994,7 @@ class BidderParamsSpec extends BaseSpec {
def "PBS should send request to bidder when adapters.bidder.aliases.bidder.meta-info.currency-accepted intersect with requested currency"() {
given: "PBS with adapter configuration"
def pbsService = pbsServiceFactory.getService(
"adapters.generic.aliases.alias.enabled" : "true",
"adapters.generic.aliases.alias.enabled": "true",
"adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString(),
"adapters.generic.aliases.alias.meta-info.currency-accepted": "${USD},${EUR}".toString())

Expand Down Expand Up @@ -996,7 +1035,7 @@ class BidderParamsSpec extends BaseSpec {
def "PBS shouldn't send request to bidder and emit warning when adapters.bidder.aliases.bidder.meta-info.currency-accepted not intersect with requested currency"() {
given: "PBS with adapter configuration"
def pbsService = pbsServiceFactory.getService(
"adapters.generic.aliases.alias.enabled" : "true",
"adapters.generic.aliases.alias.enabled": "true",
"adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString(),
"adapters.generic.aliases.alias.meta-info.currency-accepted": "${JPY},${CHF}".toString())

Expand Down