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,7 @@ import static org.prebid.server.functional.model.bidder.BidderName.OPENX
import static org.prebid.server.functional.model.bidder.BidderName.RUBICON
import static org.prebid.server.functional.model.bidder.BidderName.UNKNOWN
import static org.prebid.server.functional.model.bidder.BidderName.WILDCARD
import static org.prebid.server.functional.model.bidder.BidderName.GENER_X
import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID
import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer

Expand Down Expand Up @@ -131,6 +132,42 @@ class ImpRequestSpec extends BaseSpec {
ALIAS_CAMEL_CASE | GENERIC_CAMEL_CASE
}

def "PBS should update imp fields only for specific alias when request has multiple aliases"() {
given: "Default basic BidRequest"
def storedPmp = Pmp.defaultPmp
def originalPmp = Pmp.defaultPmp
def bidRequest = BidRequest.defaultBidRequest.tap {
imp.first.tap {
pmp = originalPmp
ext.prebid.imp = [(aliasName): new Imp(pmp: storedPmp)]
ext.prebid.bidder.generic = null
ext.prebid.bidder.generX = new Generic()
ext.prebid.bidder.alias = new Generic()
}
ext.prebid.aliases = [(GENER_X.value) : bidderName,
(aliasName.value): bidderName,
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Formating

}

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

then: "BidderRequest should update imp information for specific alias"
def bidderRequests = getRequests(response)
assert bidderRequests.size() == 2
assert bidderRequests[ALIAS.value].imp.pmp.flatten() == [storedPmp]

and: "Left original information for other"
assert bidderRequests[GENER_X.value].imp.pmp.flatten() == [originalPmp]

where:
aliasName | bidderName
ALIAS | GENERIC
ALIAS_CAMEL_CASE | GENERIC
ALIAS | GENERIC_CAMEL_CASE
ALIAS_CAMEL_CASE | GENERIC_CAMEL_CASE
}

def "PBS shouldn't update imp fields when imp.ext.prebid.imp contain only bidder with invalid name"() {
given: "Default basic BidRequest"
def impPmp = Pmp.defaultPmp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GdprSetUidSpec extends PrivacyBaseSpec {
.build()
}

and: "Default uids cookie with gener_x bidder"
and: "Default uids cookie with generic bidder"
def uidsCookie = UidsCookie.defaultUidsCookie.tap {
it.tempUIDs = [(GENERIC): defaultUidWithExpiry]
}
Expand Down