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

Redefine logic regarding imp.ext.<bidder> #3318

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -0,0 +1,9 @@
package org.prebid.server.functional.model.request.auction

import groovy.transform.EqualsAndHashCode

@EqualsAndHashCode
class Foo {

String anyProperty
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ImpExt {
String all
String skadn
String general
String foo
Foo foo

static ImpExt getDefaultImpExt() {
new ImpExt().tap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.prebid.server.functional.model.request.amp.AmpRequest
import org.prebid.server.functional.model.request.auction.Banner
import org.prebid.server.functional.model.request.auction.BidRequest
import org.prebid.server.functional.model.request.auction.Device
import org.prebid.server.functional.model.request.auction.Foo
import org.prebid.server.functional.model.request.auction.Geo
import org.prebid.server.functional.model.request.auction.Imp
import org.prebid.server.functional.model.request.auction.ImpExt
Expand Down Expand Up @@ -727,9 +728,9 @@ class BidderParamsSpec extends BaseSpec {

def "PBS shouldn't emit warning and proceed auction when imp.ext.foo and imp.ext.prebid.bidder.generic in the request"() {
given: "Default bid request"
def randomString = PBSUtils.randomString
def foo = new Foo(anyProperty: PBSUtils.randomString)
def bidRequest = BidRequest.defaultBidRequest.tap {
imp[0].ext.foo = randomString
imp[0].ext.foo = foo
imp[0].ext.prebid.bidder.generic = new Generic()
}

Expand All @@ -738,32 +739,33 @@ class BidderParamsSpec extends BaseSpec {

then: "Bidder request should contain imp.ext.foo"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.imp[0].ext.foo == randomString
assert bidderRequest.imp[0].ext.foo == foo

and: "Response shouldn't contain warning"
assert !response?.ext?.warnings
}

def "PBS should emit warning and proceed auction when imp.ext.foo and imp.ext.generic in the request"() {
given: "Default bid request"
def randomString = PBSUtils.randomString
def foo = new Foo(anyProperty: PBSUtils.randomString)
def bidRequest = BidRequest.defaultBidRequest.tap {
imp[0].ext.generic = new Generic()
imp[0].ext.foo = randomString
imp[0].ext.prebid.bidder.generic = null
imp[0].ext.foo = foo
imp[0].ext.prebid.bidder = null
}

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

then: "Bidder request should contain imp.ext.foo"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.imp[0].ext.foo == randomString
assert bidderRequest.imp[0].ext.foo == foo

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

def "PBS shouldn't emit warning and proceed auction when imp.ext.foo and imp.ext.generic in the request"() {
Expand All @@ -789,7 +791,7 @@ class BidderParamsSpec extends BaseSpec {

then: "Bidder request should contain same field as requested"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
verifyAll(bidderRequest.imp[0].ext){
verifyAll(bidderRequest.imp[0].ext) {
bidder == impExt.generic
ae == impExt.ae
all == impExt.all
Expand Down
Loading