|
1 | 1 | package org.prebid.server.functional.tests.privacy.tcf |
2 | 2 |
|
3 | 3 | import org.prebid.server.functional.model.bidder.BidderName |
| 4 | +import org.prebid.server.functional.model.config.AccountGdprConfig |
4 | 5 | import org.prebid.server.functional.model.config.Purpose |
| 6 | +import org.prebid.server.functional.model.config.PurposeConfig |
5 | 7 | import org.prebid.server.functional.model.privacy.EnforcementRequirement |
6 | 8 | import org.prebid.server.functional.model.response.auction.NoBidResponse |
7 | 9 | import org.prebid.server.functional.service.PrebidServerService |
8 | 10 | import org.prebid.server.functional.util.PBSUtils |
| 11 | +import org.prebid.server.functional.util.privacy.TcfConsent |
9 | 12 | import org.prebid.server.functional.util.privacy.TcfUtils |
10 | 13 |
|
11 | 14 | import java.time.ZoneId |
12 | 15 | import java.time.ZonedDateTime |
13 | 16 |
|
| 17 | +import static org.prebid.server.functional.model.config.PurposeEnforcement.NO |
14 | 18 | import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID |
15 | 19 | import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID |
16 | 20 |
|
@@ -416,8 +420,53 @@ class TcfGeneralSpec extends TcfBaseSpec { |
416 | 420 | assert metrics[TCF_NO_DISCLOSED_VENDORS_METRIC] == 1 |
417 | 421 |
|
418 | 422 | 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" |
422 | 471 | } |
423 | 472 | } |
0 commit comments