Skip to content
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: Add adUnitCode to exception list #3599

Merged
Show file tree
Hide file tree
Changes from 4 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 shouldn't emit warning and proceed auction when all ext.prebid.bidderParams fields known for PBS"() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct test name, since for now sounds like we shouldn't proceed auction

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