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

Test: Transition PAAPI parameters #3634

Open
wants to merge 12 commits into
base: feature/paa
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.bidder.BidderName
import org.prebid.server.functional.model.request.auction.BidAdjustment
import org.prebid.server.functional.model.request.auction.PaaFormant
import org.prebid.server.functional.model.request.auction.Targeting
import org.prebid.server.functional.model.response.auction.MediaType

Expand All @@ -23,6 +24,7 @@ class AccountAuctionConfig {
AccountEventsConfig events
AccountPriceFloorsConfig priceFloors
Targeting targeting
PaaFormant paaformat
osulzhenko marked this conversation as resolved.
Show resolved Hide resolved
@JsonProperty("preferredmediatype")
Map<BidderName, MediaType> preferredMediaType
@JsonProperty("privacysandbox")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonValue
import org.prebid.server.functional.util.PBSUtils

enum AuctionEnvironment {

NOT_SUPPORTED(0),
DEVICE_ORCHESTRATED(1),
SERVER_ORCHESTRATED(3),
UNKNOWN(PBSUtils.getRandomNumberWithExclusion([NOT_SUPPORTED.value,
DEVICE_ORCHESTRATED.value,
SERVER_ORCHESTRATED.value])),
osulzhenko marked this conversation as resolved.
Show resolved Hide resolved

@JsonValue
private int value

AuctionEnvironment(Integer value) {
this.value = value
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ class ImpExt {
String tid
String gpid
String sid
Integer ae
AuctionEnvironment ae
osulzhenko marked this conversation as resolved.
Show resolved Hide resolved
String all
String skadn
String general
@JsonProperty("igs")
InterestGroupAuctionSupport interestGroupAuctionSupport
AnyUnsupportedBidder anyUnsupportedBidder

static ImpExt getDefaultImpExt() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonProperty
import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionSupport {

@JsonProperty("ae")
AuctionEnvironment auctionEnvironment
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonValue

enum PaaFormant {

ORIGINAL, IAB

@JsonValue
String getValue() {
name().toLowerCase()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Prebid {
PrebidModulesConfig modules
PrebidAnalytics analytics
StoredAuctionResponse storedAuctionResponse
PaaFormant paaFormat

static class Channel {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.prebid.server.functional.model.response.auction

import com.fasterxml.jackson.annotation.JsonProperty
import groovy.transform.ToString
import org.prebid.server.functional.model.response.BidderError
import org.prebid.server.functional.model.response.Debug
Expand All @@ -15,4 +16,6 @@ class BidResponseExt {
Map<String, ResponseSyncData> usersync
BidResponsePrebid prebid
Map<ErrorType, List<WarningEntry>> warnings
@JsonProperty("igi")
List<InterestGroupAuctionIntent> interestGroupAuctionIntent
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.prebid.server.functional.model.response.auction

import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.Currency

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy)
class InterestGroupAuctionBuyer {

String origin
BigDecimal maxBid
Currency cur
Map pbs
InterestGroupAuctionBuyerExt ext
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.prebid.server.functional.model.response.auction

import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionBuyerExt {

String bidder
String adapter
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.prebid.server.functional.model.response.auction

import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy)
class InterestGroupAuctionIntent {

String impId
@JsonProperty("igb")
List<InterestGroupAuctionBuyer> interestGroupAuctionBuyer
@JsonProperty("igs")
List<InterestGroupAuctionSeller> interestGroupAuctionSeller
InterestGroupAuctionIntentExt ext
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.prebid.server.functional.model.response.auction

import groovy.transform.ToString
import org.prebid.server.functional.model.bidder.BidderName

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionIntentExt {

BidderName bidder
BidderName adapter
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.prebid.server.functional.model.response.auction

import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy)
class InterestGroupAuctionSeller {

String impId
Map config
InterestGroupAuctionSellerExt ext
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.prebid.server.functional.model.response.auction

import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
class InterestGroupAuctionSellerExt {

String bidder
String adapter
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.prebid.server.functional.model.response.auction


import groovy.transform.ToString
import org.prebid.server.functional.model.request.auction.BidRequest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.prebid.server.functional.model.db.Account
import org.prebid.server.functional.model.db.StoredImp
import org.prebid.server.functional.model.db.StoredRequest
import org.prebid.server.functional.model.request.amp.AmpRequest
import org.prebid.server.functional.model.request.auction.AuctionEnvironment
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
Expand All @@ -15,6 +16,7 @@ import org.prebid.server.functional.model.request.auction.Imp
import org.prebid.server.functional.model.request.auction.ImpExt
import org.prebid.server.functional.model.request.auction.ImpExtContext
import org.prebid.server.functional.model.request.auction.ImpExtContextData
import org.prebid.server.functional.model.request.auction.InterestGroupAuctionSupport
import org.prebid.server.functional.model.request.auction.Native
import org.prebid.server.functional.model.request.auction.PrebidStoredRequest
import org.prebid.server.functional.model.request.auction.Site
Expand All @@ -34,6 +36,10 @@ import static org.prebid.server.functional.model.bidder.BidderName.APPNEXUS
import static org.prebid.server.functional.model.bidder.CompressionType.GZIP
import static org.prebid.server.functional.model.bidder.CompressionType.NONE
import static org.prebid.server.functional.model.request.auction.Asset.titleAsset
import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.DEVICE_ORCHESTRATED
import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.NOT_SUPPORTED
import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.SERVER_ORCHESTRATED
import static org.prebid.server.functional.model.request.auction.AuctionEnvironment.UNKNOWN
import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP
import static org.prebid.server.functional.model.request.auction.DistributionChannel.DOOH
import static org.prebid.server.functional.model.request.auction.DistributionChannel.SITE
Expand Down Expand Up @@ -847,7 +853,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 +961,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 +1002,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 Expand Up @@ -1040,4 +1046,66 @@ class BidderParamsSpec extends BaseSpec {
assert seatNonBid.nonBid[0].impId == bidRequest.imp[0].id
assert seatNonBid.nonBid[0].statusCode == REQUEST_BLOCKED_UNACCEPTABLE_CURRENCY
}

def "PBS should pass imp.ext.ae to imp.ext.igs.ae when imp.ext.ae specified and imp.ext.igs.ae doesn't specified"() {
osulzhenko marked this conversation as resolved.
Show resolved Hide resolved
given: "Default bid request with populated imp.ext"
def bidRequest = BidRequest.defaultBidRequest.tap {
imp[0].ext.tap {
ae = auctionEnvironment
interestGroupAuctionSupport = new InterestGroupAuctionSupport(auctionEnvironment: null)
}
}

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

then: "Bidder request should imp[].{ae/ext.igs.ae} same value as requested"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.imp[0].ext.ae == auctionEnvironment
assert bidderRequest.imp[0].ext.interestGroupAuctionSupport.auctionEnvironment == auctionEnvironment
osulzhenko marked this conversation as resolved.
Show resolved Hide resolved

where:
auctionEnvironment << [NOT_SUPPORTED, DEVICE_ORCHESTRATED]
}

def "PBS shouldn't pass imp.ext.ae to imp.ext.igs.ae when imp.ext.ae specified and contain not a 0 or 1"() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

PBS shouldn't add unsupported auction environment to imp.ext.igs when it is present in imp.ext and imp.ext.igs is empty

given: "Default bid request with populated imp.ext"
def bidRequest = BidRequest.defaultBidRequest.tap {
imp[0].ext.tap {
ae = auctionEnvironment
interestGroupAuctionSupport = new InterestGroupAuctionSupport(auctionEnvironment: null)
}
}

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

then: "Bidder request should imp[].ae same value as requested"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.imp[0].ext.ae == auctionEnvironment
assert !bidderRequest.imp[0].ext.interestGroupAuctionSupport.auctionEnvironment

where:
auctionEnvironment << [SERVER_ORCHESTRATED, UNKNOWN]
}

def "PBS shouldn't pass imp.ext.ae to imp.ext.igs.ae when imp.ext.ae and imp.ext.igs.ae specified"() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

PBS shouldn't change auction environment in imp.ext.igs when it is present in both imp.ext and imp.ext.igs

given: "Default bid request with populated imp.ext"
def extAuctionEnv = PBSUtils.getRandomEnum(AuctionEnvironment)
def extIgsAuctionEnv = PBSUtils.getRandomEnum(AuctionEnvironment)
def bidRequest = BidRequest.defaultBidRequest.tap {
imp[0].ext.tap {
ae = extAuctionEnv
interestGroupAuctionSupport = new InterestGroupAuctionSupport(auctionEnvironment: extIgsAuctionEnv)
}
}

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

then: "Bidder request should imp[].{ae/ext.igs.ae} same value as requested"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.imp[0].ext.ae == extAuctionEnv
assert bidderRequest.imp[0].ext.interestGroupAuctionSupport.auctionEnvironment == extIgsAuctionEnv
}
}
Loading
Loading