Skip to content

Commit 11f7c93

Browse files
authored
Test: TcfV1 and DisclosedVendors section (#4513)
1 parent cf24235 commit 11f7c93

1 file changed

Lines changed: 52 additions & 3 deletions

File tree

src/test/groovy/org/prebid/server/functional/tests/privacy/tcf/TcfGeneralSpec.groovy

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
package org.prebid.server.functional.tests.privacy.tcf
22

33
import org.prebid.server.functional.model.bidder.BidderName
4+
import org.prebid.server.functional.model.config.AccountGdprConfig
45
import org.prebid.server.functional.model.config.Purpose
6+
import org.prebid.server.functional.model.config.PurposeConfig
57
import org.prebid.server.functional.model.privacy.EnforcementRequirement
68
import org.prebid.server.functional.model.response.auction.NoBidResponse
79
import org.prebid.server.functional.service.PrebidServerService
810
import org.prebid.server.functional.util.PBSUtils
11+
import org.prebid.server.functional.util.privacy.TcfConsent
912
import org.prebid.server.functional.util.privacy.TcfUtils
1013

1114
import java.time.ZoneId
1215
import java.time.ZonedDateTime
1316

17+
import static org.prebid.server.functional.model.config.PurposeEnforcement.NO
1418
import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID
1519
import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID
1620

@@ -416,8 +420,53 @@ class TcfGeneralSpec extends TcfBaseSpec {
416420
assert metrics[TCF_NO_DISCLOSED_VENDORS_METRIC] == 1
417421

418422
where:
419-
pbsService | serviceName
420-
pbsWithoutGvlVendorsWithStrictDvTreatment | "without GVL vendors"
421-
pbsWithMultipleGvlListsWithStrictDvTreatment | "with multiple GVL lists"
423+
pbsService | serviceName
424+
pbsWithoutGvlVendorsWithStrictDvTreatment | "without GVL vendors"
425+
pbsWithMultipleGvlListsWithStrictDvTreatment | "with multiple GVL lists"
426+
}
427+
428+
def "PBS should reject auction for deprecated TCF v1 consent regardless of disclosed vendors configuration #serviceName"() {
429+
given: "BidRequest with deprecated TCF v1 consent"
430+
def tcfConsent = new TcfConsent.Builder()
431+
.setPurposesConsent(TcfConsent.PurposeId.BASIC_ADS)
432+
.setVersion(1)
433+
.setDisclosedVendors([GENERIC_VENDOR_ID])
434+
.setCreateTime(ZonedDateTime.now())
435+
.setUpdatedTime(ZonedDateTime.now())
436+
.build()
437+
def bidRequest = getGdprBidRequest(tcfConsent)
438+
439+
and: "Account GDPR config with disabled vendor enforcement"
440+
def purposes = [(Purpose.P2): new PurposeConfig(enforcePurpose: NO, enforceVendors: false)]
441+
def accountGdprConfig = new AccountGdprConfig(purposes: purposes)
442+
def account = getAccountWithGdpr(bidRequest.accountId, accountGdprConfig)
443+
accountDao.save(account)
444+
445+
and: "Flush metric"
446+
flushMetrics(pbsService)
447+
448+
when: "PBS processes auction requests"
449+
def response = pbsService.sendAuctionRequest(bidRequest)
450+
451+
then: "Response shouldn't contain seatBid"
452+
assert response?.seatbid?.bid?.flatten()?.isEmpty()
453+
454+
and: "PBS should emit proper nbr code"
455+
assert response.noBidResponse == NoBidResponse.UNKNOWN_ERROR
456+
457+
and: "PBS response shouldn't provide proper error"
458+
assert !response.ext.errors
459+
460+
and: "PBS should contain TCF deprecation warning"
461+
assert response.ext.warnings[PREBID].message == ["Parsing consent string:\"${tcfConsent}\" failed. " +
462+
"TCF version 1 is deprecated and treated as corrupted TCF version 2"]
463+
464+
and: "PBS should not send bid request to bidder"
465+
assert !bidder.getBidderRequests(bidRequest.id)
466+
467+
where:
468+
pbsService | serviceName
469+
pbsWithoutGvlVendorsWithStrictDvTreatment | "without GVL vendors"
470+
pbsWithMultipleGvlListsWithStrictDvTreatment | "with multiple GVL lists"
422471
}
423472
}

0 commit comments

Comments
 (0)