@@ -23,15 +23,21 @@ import static org.prebid.server.functional.model.pricefloors.Country.CAN
2323import static org.prebid.server.functional.model.pricefloors.Country.USA
2424import static org.prebid.server.functional.model.request.GppSectionId.US_CA_V1
2525import static org.prebid.server.functional.model.request.GppSectionId.US_CO_V1
26+ import static org.prebid.server.functional.model.request.GppSectionId.US_NAT_V1
2627import static org.prebid.server.functional.model.request.auction.ActivityType.FETCH_BIDS
2728import static org.prebid.server.functional.model.request.auction.ActivityType.TRANSMIT_EIDS
2829import static org.prebid.server.functional.model.request.auction.ActivityType.TRANSMIT_PRECISE_GEO
2930import static org.prebid.server.functional.model.request.auction.ActivityType.TRANSMIT_TID
3031import static org.prebid.server.functional.model.request.auction.ActivityType.TRANSMIT_UFPD
3132import static org.prebid.server.functional.model.request.auction.Condition.ConditionType.BIDDER
33+ import static org.prebid.server.functional.model.request.auction.PrivacyModule.ALL
34+ import static org.prebid.server.functional.model.request.auction.PrivacyModule.IAB_US_CUSTOM_LOGIC
3235import static org.prebid.server.functional.model.request.auction.PrivacyModule.IAB_US_GENERAL
3336import static org.prebid.server.functional.model.request.auction.TraceLevel.BASIC
3437import static org.prebid.server.functional.model.request.auction.TraceLevel.VERBOSE
38+ import static org.prebid.server.functional.model.response.auction.RuleResult.ABSTAIN
39+ import static org.prebid.server.functional.model.response.auction.RuleResult.ALLOW
40+ import static org.prebid.server.functional.model.response.auction.RuleResult.DISALLOW
3541import static org.prebid.server.functional.util.privacy.model.State.ALABAMA
3642import static org.prebid.server.functional.util.privacy.model.State.ARIZONA
3743
@@ -101,7 +107,7 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
101107 country : USA . ISOAlpha3 ))
102108 assert fetchBidsActivity. ruleConfiguration. every { it == null }
103109 assert fetchBidsActivity. allowByDefault. contains(activity. defaultAction)
104- assert fetchBidsActivity. result. contains(" DISALLOW" )
110+ assert fetchBidsActivity. result. contains(DISALLOW )
105111 assert fetchBidsActivity. country. every { it == null }
106112 assert fetchBidsActivity. region. every { it == null }
107113 }
@@ -141,7 +147,7 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
141147 country : USA . ISOAlpha3 ))
142148 assert fetchBidsActivity. allowByDefault. contains(activity. defaultAction)
143149 assert fetchBidsActivity. ruleConfiguration. every { it == null }
144- assert fetchBidsActivity. result. contains(" ALLOW" )
150+ assert fetchBidsActivity. result. contains(ALLOW )
145151 assert fetchBidsActivity. country. every { it == null }
146152 assert fetchBidsActivity. region. every { it == null }
147153
@@ -241,7 +247,7 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
241247 gpc : gpc,
242248 geoCodes : [new GeoCode (country : CAN , region : ARIZONA . abbreviation)]))
243249 assert fetchBidsActivity. allowByDefault. contains(activity. defaultAction)
244- assert fetchBidsActivity. result. contains(" ABSTAIN" )
250+ assert fetchBidsActivity. result. contains(ABSTAIN )
245251 assert fetchBidsActivity. country. every { it == null }
246252 assert fetchBidsActivity. region. every { it == null }
247253
@@ -347,7 +353,7 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
347353 assert fetchBidsActivity. ruleConfiguration. contains(new RuleConfiguration (
348354 and : [new And (and : [" USNatDefault. Precomputed result: ABSTAIN." ])]))
349355 assert fetchBidsActivity. allowByDefault. contains(activity. defaultAction)
350- assert fetchBidsActivity. result. contains(" ABSTAIN" )
356+ assert fetchBidsActivity. result. contains(ABSTAIN )
351357 assert fetchBidsActivity. country. every { it == null }
352358 assert fetchBidsActivity. region. every { it == null }
353359
@@ -405,26 +411,21 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
405411 def " PBS auction should log info about activity in response when ext.prebid.trace=verbose and skipRate=#skipRate" () {
406412 given : " Default bid request"
407413 def accountId = PBSUtils . randomNumber as String
408- def bidRequest = BidRequest . defaultBidRequest . tap {
414+ def bidRequest = getBidRequestWithPersonalData(accountId) . tap {
409415 ext. prebid. trace = VERBOSE
410- device = new Device (geo : new Geo (country : USA , region : ALABAMA . abbreviation))
411- regs. ext = new RegsExt (gpc : PBSUtils . randomString)
412- regs. gppSid = [US_CA_V1 . intValue]
413- regs. gpp = new UsNatV1Consent.Builder (). setGpc(true ). build()
414- setAccountId(accountId)
416+ regs. gpp = SIMPLE_GPC_DISALLOW_LOGIC
417+ regs. gppSid = [US_NAT_V1 . intValue]
415418 }
416419
417420 and : " Set up activities"
418- def gpc = PBSUtils . randomString
419421 def condition = Condition . baseCondition. tap {
420- it. gpc = gpc
421- it. geo = [CAN . withState(ARIZONA )]
422+ it. gppSid = [US_NAT_V1 . intValue]
422423 }
423424 def activityRule = ActivityRule . getDefaultActivityRule(condition). tap {
424425 it. privacyRegulation = [IAB_US_GENERAL ]
425426 }
426427 def activity = Activity . getDefaultActivity([activityRule])
427- def activities = AllowActivities . getDefaultAllowActivities(FETCH_BIDS , activity)
428+ def activities = AllowActivities . getDefaultAllowActivities(TRANSMIT_EIDS , activity)
428429
429430 and : " Account gpp configuration"
430431 def accountGppConfig = new AccountGppConfig (code : IAB_US_GENERAL , enabled : true , skipRate : skipRate)
@@ -436,11 +437,19 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
436437 when : " PBS processes auction requests"
437438 def bidResponse = activityPbsService. sendAuctionRequest(bidRequest)
438439
439- then : " Bid response should contain verbose info in debug"
440+ then : " Generic bidder request should have empty EIDS fields"
441+ def genericBidderRequest = bidder. getBidderRequest(bidRequest. id)
442+
443+ verifyAll {
444+ ! genericBidderRequest. user. eids
445+ ! genericBidderRequest. user?. ext?. eids
446+ }
447+
448+ and : " Bid response should contain verbose info in debug"
440449 def infrastructure = bidResponse. ext. debug. trace. activityInfrastructure
441- def ruleConfigurations = findProcessingRule(infrastructure, FETCH_BIDS ). ruleConfiguration. and
450+ def ruleConfigurations = findProcessingRule(infrastructure, TRANSMIT_EIDS ). ruleConfiguration. and
442451 assert ruleConfigurations. size() == 1
443- assert ruleConfigurations. first. and. every { it != null }
452+ assert ruleConfigurations. first. and. every { it. contains( DISALLOW . toString()) }
444453
445454 and : " Should not contain information that module was skipped"
446455 verifyAll(ruleConfigurations. first) {
@@ -456,29 +465,24 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
456465 def " PBS auction should log info about module skip in response when ext.prebid.trace=verbose and skipRate is max" () {
457466 given : " Default bid request"
458467 def accountId = PBSUtils . randomNumber as String
459- def bidRequest = BidRequest . defaultBidRequest . tap {
468+ def bidRequest = getBidRequestWithPersonalData(accountId) . tap {
460469 ext. prebid. trace = VERBOSE
461- device = new Device (geo : new Geo (country : USA , region : ALABAMA . abbreviation))
462- regs. ext = new RegsExt (gpc : PBSUtils . randomString)
463- regs. gppSid = [US_CA_V1 . intValue]
464- regs. gpp = new UsNatV1Consent.Builder (). setGpc(true ). build()
465- setAccountId(accountId)
470+ regs. gpp = SIMPLE_GPC_DISALLOW_LOGIC
471+ regs. gppSid = [US_NAT_V1 . intValue]
466472 }
467473
468474 and : " Set up activities"
469- def gpc = PBSUtils . randomString
470475 def condition = Condition . baseCondition. tap {
471- it. gpc = gpc
472- it. geo = [CAN . withState(ARIZONA )]
476+ it. gppSid = [US_NAT_V1 . intValue]
473477 }
474478 def activityRule = ActivityRule . getDefaultActivityRule(condition). tap {
475- it. privacyRegulation = [IAB_US_GENERAL ]
479+ it. privacyRegulation = [ALL ]
476480 }
477- def activity = Activity . getDefaultActivity([activityRule], defaultAction )
478- def activities = AllowActivities . getDefaultAllowActivities(FETCH_BIDS , activity)
481+ def activity = Activity . getDefaultActivity([activityRule])
482+ def activities = AllowActivities . getDefaultAllowActivities(TRANSMIT_EIDS , activity)
479483
480484 and : " Account gpp configuration"
481- def accountGppConfig = new AccountGppConfig (code : IAB_US_GENERAL , enabled : true , skipRate : MAX_PERCENT_AB )
485+ def accountGppConfig = new AccountGppConfig (code : code , enabled : true , skipRate : MAX_PERCENT_AB )
482486
483487 and : " Save account with allow activities setup"
484488 def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig])
@@ -487,40 +491,43 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
487491 when : " PBS processes auction requests"
488492 def bidResponse = activityPbsService. sendAuctionRequest(bidRequest)
489493
490- then : " Bid response should not contain verbose info in debug"
494+ then : " Generic bidder request should have data in EIDS fields"
495+ def genericBidderRequest = bidder. getBidderRequest(bidRequest. id)
496+ assert genericBidderRequest. user. eids[0 ]. source == bidRequest. user. eids[0 ]. source
497+
498+ and : " Bid response should not contain verbose info in debug"
491499 def infrastructure = bidResponse. ext. debug. trace. activityInfrastructure
492- def ruleConfigurations = findProcessingRule(infrastructure, FETCH_BIDS ). ruleConfiguration. and
500+ def ruleConfigurations = findProcessingRule(infrastructure, TRANSMIT_EIDS ). ruleConfiguration. and
493501 assert ruleConfigurations. size() == 1
494502 assert ruleConfigurations. first. and. every { it == null }
495503
496504 and : " Should contain information that module was skipped"
497505 verifyAll(ruleConfigurations. first) {
498- it. privacyModule == ' iab.usgeneral '
499- it. skipped == ' true'
500- it. result == ' ABSTAIN'
506+ it. privacyModule == code
507+ it. skipped == true
508+ it. result == ABSTAIN
501509 }
502510
503511 where :
504- defaultAction << [false , true ]
512+ code | defaultAction
513+ IAB_US_GENERAL | false
514+ IAB_US_GENERAL | true
515+ IAB_US_CUSTOM_LOGIC | false
516+ IAB_US_CUSTOM_LOGIC | true
505517 }
506518
507519 def " PBS auction should log consistently for each activity about skips modules in response" () {
508520 given : " Default bid request"
509521 def accountId = PBSUtils . randomNumber as String
510- def bidRequest = BidRequest . defaultBidRequest . tap {
522+ def bidRequest = getBidRequestWithPersonalData(accountId) . tap {
511523 ext. prebid. trace = VERBOSE
512- device = new Device (geo : new Geo (country : USA , region : ALABAMA . abbreviation))
513- regs. ext = new RegsExt (gpc : PBSUtils . randomString)
514- regs. gppSid = [US_CA_V1 . intValue]
515- regs. gpp = new UsNatV1Consent.Builder (). build()
516- setAccountId(accountId)
524+ regs. gpp = SIMPLE_GPC_DISALLOW_LOGIC
525+ regs. gppSid = [US_NAT_V1 . intValue]
517526 }
518527
519528 and : " Set up activities"
520- def gpc = PBSUtils . randomString
521529 def condition = Condition . baseCondition. tap {
522- it. gpc = gpc
523- it. geo = [CAN . withState(ARIZONA )]
530+ it. gppSid = [US_NAT_V1 . intValue]
524531 }
525532 def activityRule = ActivityRule . getDefaultActivityRule(condition). tap {
526533 it. privacyRegulation = [IAB_US_GENERAL ]
@@ -565,26 +572,21 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec {
565572 def " PBS auction shouldn't emit errors or warnings when skip rate is out of borders" () {
566573 given : " Default bid request"
567574 def accountId = PBSUtils . randomNumber as String
568- def bidRequest = BidRequest . defaultBidRequest . tap {
575+ def bidRequest = getBidRequestWithPersonalData(accountId) . tap {
569576 ext. prebid. trace = VERBOSE
570- device = new Device (geo : new Geo (country : USA , region : ALABAMA . abbreviation))
571- regs. ext = new RegsExt (gpc : PBSUtils . randomString)
572- regs. gppSid = [US_CA_V1 . intValue]
573- regs. gpp = new UsNatV1Consent.Builder (). setGpc(true ). build()
574- setAccountId(accountId)
577+ regs. gpp = SIMPLE_GPC_DISALLOW_LOGIC
578+ regs. gppSid = [US_NAT_V1 . intValue]
575579 }
576580
577581 and : " Set up activities"
578- def gpc = PBSUtils . randomString
579582 def condition = Condition . baseCondition. tap {
580- it. gpc = gpc
581- it. geo = [CAN . withState(ARIZONA )]
583+ it. gppSid = [US_NAT_V1 . intValue]
582584 }
583585 def activityRule = ActivityRule . getDefaultActivityRule(condition). tap {
584586 it. privacyRegulation = [IAB_US_GENERAL ]
585587 }
586588 def activity = Activity . getDefaultActivity([activityRule])
587- def activities = AllowActivities . getDefaultAllowActivities(FETCH_BIDS , activity)
589+ def activities = AllowActivities . getDefaultAllowActivities(TRANSMIT_EIDS , activity)
588590
589591 and : " Account gpp configuration"
590592 def accountGppConfig = new AccountGppConfig (code : IAB_US_GENERAL , enabled : true , skipRate : skipRate)
0 commit comments