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 @@ -8,8 +8,8 @@ import org.prebid.server.functional.model.config.AlternateBidderCodes
import org.prebid.server.functional.model.config.BidderConfig
import org.prebid.server.functional.model.db.StoredImp
import org.prebid.server.functional.model.pricefloors.Country
import org.prebid.server.functional.model.pricefloors.MediaType
import org.prebid.server.functional.model.pricefloors.FloorModelGroup
import org.prebid.server.functional.model.pricefloors.MediaType
import org.prebid.server.functional.model.pricefloors.PriceFloorData
import org.prebid.server.functional.model.pricefloors.PriceFloorSchema
import org.prebid.server.functional.model.pricefloors.Rule
Expand All @@ -29,6 +29,8 @@ import org.prebid.server.functional.model.response.auction.BidExt
import org.prebid.server.functional.model.response.auction.BidResponse
import org.prebid.server.functional.util.PBSUtils

import java.time.Instant

import static org.prebid.server.functional.model.ChannelType.WEB
import static org.prebid.server.functional.model.bidder.BidderName.ALIAS
import static org.prebid.server.functional.model.bidder.BidderName.AMX
Expand Down Expand Up @@ -61,7 +63,6 @@ import static org.prebid.server.functional.model.request.auction.FetchStatus.ERR
import static org.prebid.server.functional.model.request.auction.Location.NO_DATA
import static org.prebid.server.functional.model.request.auction.Prebid.Channel
import static org.prebid.server.functional.model.response.auction.BidRejectionReason.RESPONSE_REJECTED_DUE_TO_PRICE_FLOOR
import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID
import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer

class PriceFloorsRulesSpec extends PriceFloorsBaseSpec {
Expand Down Expand Up @@ -177,7 +178,10 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec {
}

def "PBS should consider rules file invalid when rules file contains an unrecognized dimension in the schema"() {
given: "BidRequest with domain"
given: "Test start time"
def startTime = Instant.now()

and: "BidRequest with domain"
def domain = PBSUtils.randomString
def accountId = PBSUtils.randomString
def bidRequest = BidRequest.defaultBidRequest.tap {
Expand Down Expand Up @@ -218,14 +222,15 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec {
assert bidderRequest.ext?.prebid?.floors?.location == NO_DATA
assert bidderRequest.ext?.prebid?.floors?.fetchStatus == ERROR

and: "PBS should not contain errors"
and: "PBS should not contain errors or warnings"
assert !response.ext?.errors
assert !response.ext?.warnings

and: "PBS should log a warning"
assert response.ext?.warnings[PREBID]*.code == [999]
assert response.ext?.warnings[PREBID]*.message.first.contains("Cannot deserialize value of type " +
def logs = floorsPbsService.getLogsByTime(startTime)
assert getLogsByText(logs, "Cannot deserialize value of type " +
"`org.prebid.server.floors.model.PriceFloorField` " +
"from String \"bogus\": not one of the values accepted for Enum class")
"from String \"bogus\": not one of the values accepted for Enum class").size() == 1

and: "PBS should not reject the entire auction"
assert !response.seatbid.isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec {
assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(cookieSyncRequest, SYNC_USER)] == 1

and: "Should add a warning when in debug mode"
assert response.warnings == ["GPP string invalid: Unable to decode '$invalidGpp'"]
assert response.warnings.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())
}

def "PBS cookie sync call when request have different gpp consent but match and rejecting should exclude bidders URLs"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec {
assert genericBidderRequest.user.eids[0].source == bidRequest.user.eids[0].source

and: "Should add a warning when in debug mode"
assert response.ext.warnings[PREBID]?.code == [999]
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())

and: "Response should not contain any errors"
assert !response.ext.errors
Expand Down Expand Up @@ -2065,8 +2064,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec {
assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(ampStoredRequest, TRANSMIT_EIDS)] == 1

and: "Should add a warning when in debug mode"
assert response.ext.warnings[PREBID]?.code == [999]
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())

and: "Response should contain consent_string errors"
assert response.ext.errors[PREBID].message == ["Amp request parameter consent_string has invalid format: $invalidGpp"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec {
assert bidderRequest.user.eids == bidRequest.user.eids

and: "Should add a warning when in debug mode"
assert response.ext.warnings[PREBID]?.code == [999]
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())

and: "Response should not contain any errors"
assert !response.ext.errors
Expand Down Expand Up @@ -2712,8 +2711,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec {
assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(ampStoredRequest, TRANSMIT_UFPD)] == 1

and: "Should add a warning when in debug mode"
assert response.ext.warnings[PREBID]?.code == [999]
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())

and: "Response should contain consent_string errors"
assert response.ext.errors[PREBID].message == ["Amp request parameter consent_string has invalid format: $invalidGpp"]
Expand Down
Loading