From 1c8f64d9f0f2ca7398ed9093821aeb84b27d5fe3 Mon Sep 17 00:00:00 2001 From: Brian Sardo <1168933+bsardo@users.noreply.github.com> Date: Thu, 13 May 2021 11:28:05 -0400 Subject: [PATCH] Refactor: Removed unused GDPR return value (#1839) --- endpoints/auction_test.go | 5 ++-- endpoints/cookie_sync_test.go | 4 +-- endpoints/setuid_test.go | 16 +++++----- exchange/utils.go | 2 +- exchange/utils_test.go | 4 +-- gdpr/gdpr.go | 2 +- gdpr/impl.go | 47 +++++++++++------------------ gdpr/impl_test.go | 56 +++++++++++------------------------ 8 files changed, 52 insertions(+), 84 deletions(-) diff --git a/endpoints/auction_test.go b/endpoints/auction_test.go index 17ed7f74f45..f8b4f9d9b77 100644 --- a/endpoints/auction_test.go +++ b/endpoints/auction_test.go @@ -441,7 +441,6 @@ func TestShouldUsersync(t *testing.T) { type auctionMockPermissions struct { allowBidderSync bool allowHostCookies bool - allowPI bool allowGeo bool allowID bool } @@ -454,8 +453,8 @@ func (m *auctionMockPermissions) BidderSyncAllowed(ctx context.Context, bidder o return m.allowBidderSync, nil } -func (m *auctionMockPermissions) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { - return m.allowPI, m.allowGeo, m.allowID, nil +func (m *auctionMockPermissions) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { + return m.allowGeo, m.allowID, nil } func TestBidSizeValidate(t *testing.T) { diff --git a/endpoints/cookie_sync_test.go b/endpoints/cookie_sync_test.go index d4b89a15118..bfd6c507de5 100644 --- a/endpoints/cookie_sync_test.go +++ b/endpoints/cookie_sync_test.go @@ -254,6 +254,6 @@ func (g *gdprPerms) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.Bi return ok, nil } -func (g *gdprPerms) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { - return true, true, true, nil +func (g *gdprPerms) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { + return true, true, nil } diff --git a/endpoints/setuid_test.go b/endpoints/setuid_test.go index 0d68c15bea8..45ea2490c5b 100644 --- a/endpoints/setuid_test.go +++ b/endpoints/setuid_test.go @@ -389,9 +389,9 @@ func makeRequest(uri string, existingSyncs map[string]string) *http.Request { func doRequest(req *http.Request, metrics metrics.MetricsEngine, validFamilyNames []string, gdprAllowsHostCookies bool, gdprReturnsError bool) *httptest.ResponseRecorder { cfg := config.Configuration{} perms := &mockPermsSetUID{ - allowHost: gdprAllowsHostCookies, - errorHost: gdprReturnsError, - allowPI: true, + allowHost: gdprAllowsHostCookies, + errorHost: gdprReturnsError, + personalInfoAllowed: true, } analytics := analyticsConf.NewPBSAnalytics(&cfg.Analytics) syncers := make(map[openrtb_ext.BidderName]usersync.Usersyncer) @@ -422,9 +422,9 @@ func parseCookieString(t *testing.T, response *httptest.ResponseRecorder) *users } type mockPermsSetUID struct { - allowHost bool - errorHost bool - allowPI bool + allowHost bool + errorHost bool + personalInfoAllowed bool } func (g *mockPermsSetUID) HostCookiesAllowed(ctx context.Context, gdprSignal gdpr.Signal, consent string) (bool, error) { @@ -439,8 +439,8 @@ func (g *mockPermsSetUID) BidderSyncAllowed(ctx context.Context, bidder openrtb_ return false, nil } -func (g *mockPermsSetUID) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { - return g.allowPI, g.allowPI, g.allowPI, nil +func (g *mockPermsSetUID) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal gdpr.Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { + return g.personalInfoAllowed, g.personalInfoAllowed, nil } func newFakeSyncer(familyName string) usersync.Usersyncer { diff --git a/exchange/utils.go b/exchange/utils.go index 5bde1bd7889..e367facbcec 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -133,7 +133,7 @@ func cleanOpenRTBRequests(ctx context.Context, } } var publisherID = req.LegacyLabels.PubID - _, geo, id, err := gDPR.PersonalInfoAllowed(ctx, bidderRequest.BidderCoreName, publisherID, gdprSignal, consent, weakVendorEnforcement) + geo, id, err := gDPR.PersonalInfoAllowed(ctx, bidderRequest.BidderCoreName, publisherID, gdprSignal, consent, weakVendorEnforcement) if err == nil { privacyEnforcement.GDPRGeo = !geo privacyEnforcement.GDPRID = !id diff --git a/exchange/utils_test.go b/exchange/utils_test.go index 55a0950aac6..9f6041e9e4a 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -32,8 +32,8 @@ func (p *permissionsMock) BidderSyncAllowed(ctx context.Context, bidder openrtb_ return true, nil } -func (p *permissionsMock) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdpr gdpr.Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { - return p.personalInfoAllowed, p.personalInfoAllowed, p.personalInfoAllowed, p.personalInfoAllowedError +func (p *permissionsMock) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdpr gdpr.Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { + return p.personalInfoAllowed, p.personalInfoAllowed, p.personalInfoAllowedError } func assertReq(t *testing.T, bidderRequests []BidderRequest, diff --git a/gdpr/gdpr.go b/gdpr/gdpr.go index 616d0f0ae07..2b450160b62 100644 --- a/gdpr/gdpr.go +++ b/gdpr/gdpr.go @@ -25,7 +25,7 @@ type Permissions interface { // Determines whether or not to send PI information to a bidder, or mask it out. // // If the consent string was nonsensical, the returned error will be an ErrorMalformedConsent. - PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) + PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) } // Versions of the GDPR TCF technical specification. diff --git a/gdpr/impl.go b/gdpr/impl.go index 55d1cd4aeb0..22b4dbe3284 100644 --- a/gdpr/impl.go +++ b/gdpr/impl.go @@ -63,19 +63,19 @@ func (p *permissionsImpl) PersonalInfoAllowed(ctx context.Context, PublisherID string, gdprSignal Signal, consent string, - weakVendorEnforcement bool) (allowPI bool, allowGeo bool, allowID bool, err error) { + weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { if _, ok := p.cfg.NonStandardPublisherMap[PublisherID]; ok { - return true, true, true, nil + return true, true, nil } gdprSignal = p.normalizeGDPR(gdprSignal) if gdprSignal == SignalNo { - return true, true, true, nil + return true, true, nil } if consent == "" && gdprSignal == SignalYes { - return false, false, false, nil + return false, false, nil } if id, ok := p.vendorIDs[bidder]; ok { @@ -85,8 +85,8 @@ func (p *permissionsImpl) PersonalInfoAllowed(ctx context.Context, return p.defaultVendorPermissions() } -func (p *permissionsImpl) defaultVendorPermissions() (allowPI bool, allowGeo bool, allowID bool, err error) { - return false, false, false, nil +func (p *permissionsImpl) defaultVendorPermissions() (allowGeo bool, allowID bool, err error) { + return false, false, nil } func (p *permissionsImpl) normalizeGDPR(gdprSignal Signal) Signal { @@ -135,14 +135,14 @@ func (p *permissionsImpl) allowSync(ctx context.Context, vendorID uint16, consen return false, nil } -func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { +func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { parsedConsent, vendor, err := p.parseVendor(ctx, vendorID, consent) if err != nil { - return false, false, false, err + return false, false, err } if vendor == nil { - return false, false, false, nil + return false, false, nil } if parsedConsent.Version() == 2 { @@ -150,20 +150,19 @@ func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent return p.allowPITCF2(parsedConsent, vendor, vendorID, weakVendorEnforcement) } if (vendor.Purpose(consentconstants.InfoStorageAccess) || vendor.LegitimateInterest(consentconstants.InfoStorageAccess) || weakVendorEnforcement) && parsedConsent.PurposeAllowed(consentconstants.InfoStorageAccess) && (vendor.Purpose(consentconstants.PersonalizationProfile) || vendor.LegitimateInterest(consentconstants.PersonalizationProfile) || weakVendorEnforcement) && parsedConsent.PurposeAllowed(consentconstants.PersonalizationProfile) && (parsedConsent.VendorConsent(vendorID) || weakVendorEnforcement) { - return true, true, true, nil + return true, true, nil } } else { if (vendor.Purpose(tcf1constants.InfoStorageAccess) || vendor.LegitimateInterest(tcf1constants.InfoStorageAccess)) && parsedConsent.PurposeAllowed(tcf1constants.InfoStorageAccess) && (vendor.Purpose(tcf1constants.AdSelectionDeliveryReporting) || vendor.LegitimateInterest(tcf1constants.AdSelectionDeliveryReporting)) && parsedConsent.PurposeAllowed(tcf1constants.AdSelectionDeliveryReporting) && parsedConsent.VendorConsent(vendorID) { - return true, true, true, nil + return true, true, nil } } - return false, false, false, nil + return false, false, nil } -func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor api.Vendor, vendorID uint16, weakVendorEnforcement bool) (allowPI bool, allowGeo bool, allowID bool, err error) { +func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor api.Vendor, vendorID uint16, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { consent, ok := parsedConsent.(tcf2.ConsentMetadata) err = nil - allowPI = false allowGeo = false allowID = false if !ok { @@ -181,17 +180,7 @@ func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor a break } } - // Set to true so any purpose check can flip it to false - allowPI = true - if p.cfg.TCF2.Purpose1.Enabled { - allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.InfoStorageAccess, weakVendorEnforcement) - } - if p.cfg.TCF2.Purpose2.Enabled { - allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.BasicAdserving, weakVendorEnforcement) - } - if p.cfg.TCF2.Purpose7.Enabled { - allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.AdPerformance, weakVendorEnforcement) - } + return } @@ -265,8 +254,8 @@ func (a AlwaysAllow) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.B return true, nil } -func (a AlwaysAllow) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { - return true, true, true, nil +func (a AlwaysAllow) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { + return true, true, nil } // Exporting to allow for easy test setups @@ -280,6 +269,6 @@ func (a AlwaysFail) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.Bi return false, nil } -func (a AlwaysFail) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { - return false, false, false, nil +func (a AlwaysFail) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { + return false, false, nil } diff --git a/gdpr/impl_test.go b/gdpr/impl_test.go index b13d469a955..cc08aedd06b 100644 --- a/gdpr/impl_test.go +++ b/gdpr/impl_test.go @@ -181,7 +181,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous bool gdpr Signal consent string - allowPI bool + allowID bool weakVendorEnforcement bool }{ { @@ -191,7 +191,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: false, gdpr: SignalYes, consent: consent, - allowPI: true, + allowID: true, }, { description: "Allow PI - known vendor with No GDPR", @@ -199,7 +199,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: false, gdpr: SignalNo, consent: consent, - allowPI: true, + allowID: true, }, { description: "Allow PI - known vendor with Yes GDPR", @@ -207,7 +207,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: false, gdpr: SignalYes, consent: consent, - allowPI: true, + allowID: true, }, { description: "PI allowed according to host setting UserSyncIfAmbiguous true - known vendor with ambiguous GDPR and empty consent", @@ -215,7 +215,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: true, gdpr: SignalAmbiguous, consent: "", - allowPI: true, + allowID: true, }, { description: "PI allowed according to host setting UserSyncIfAmbiguous true - known vendor with ambiguous GDPR and non-empty consent", @@ -223,7 +223,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: true, gdpr: SignalAmbiguous, consent: consent, - allowPI: true, + allowID: true, }, { description: "PI allowed according to host setting UserSyncIfAmbiguous false - known vendor with ambiguous GDPR and empty consent", @@ -231,7 +231,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: false, gdpr: SignalAmbiguous, consent: "", - allowPI: false, + allowID: false, }, { description: "PI allowed according to host setting UserSyncIfAmbiguous false - known vendor with ambiguous GDPR and non-empty consent", @@ -239,7 +239,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: false, gdpr: SignalAmbiguous, consent: consent, - allowPI: true, + allowID: true, }, { description: "Don't allow PI - known vendor with Yes GDPR and empty consent", @@ -247,7 +247,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: false, gdpr: SignalYes, consent: "", - allowPI: false, + allowID: false, }, { description: "Don't allow PI - default vendor with Yes GDPR and non-empty consent", @@ -255,7 +255,7 @@ func TestAllowPersonalInfo(t *testing.T) { userSyncIfAmbiguous: false, gdpr: SignalYes, consent: consent, - allowPI: false, + allowID: false, }, } @@ -286,10 +286,10 @@ func TestAllowPersonalInfo(t *testing.T) { for _, tt := range tests { perms.cfg.UsersyncIfAmbiguous = tt.userSyncIfAmbiguous - allowPI, _, _, err := perms.PersonalInfoAllowed(context.Background(), tt.bidderName, tt.publisherID, tt.gdpr, tt.consent, tt.weakVendorEnforcement) + _, allowID, err := perms.PersonalInfoAllowed(context.Background(), tt.bidderName, tt.publisherID, tt.gdpr, tt.consent, tt.weakVendorEnforcement) assert.Nil(t, err, tt.description) - assert.Equal(t, tt.allowPI, allowPI, tt.description) + assert.Equal(t, tt.allowID, allowID, tt.description) } } @@ -347,7 +347,6 @@ type tcf2TestDef struct { description string bidder openrtb_ext.BidderName consent string - allowPI bool allowGeo bool allowID bool weakVendorEnforcement bool @@ -379,7 +378,6 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { description: "Appnexus vendor test, insufficient purposes claimed", bidder: openrtb_ext.BidderAppnexus, consent: "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", - allowPI: false, allowGeo: false, allowID: false, }, @@ -387,7 +385,6 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { description: "Appnexus vendor test, insufficient purposes claimed, basic enforcement", bidder: openrtb_ext.BidderAppnexus, consent: "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", - allowPI: true, allowGeo: true, allowID: true, weakVendorEnforcement: true, @@ -396,7 +393,6 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { description: "Pubmatic vendor test, flex purposes claimed", bidder: openrtb_ext.BidderPubmatic, consent: "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", - allowPI: true, allowGeo: true, allowID: true, }, @@ -404,7 +400,6 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { description: "Rubicon vendor test, Specific purposes/LIs claimed, no geo claimed", bidder: openrtb_ext.BidderRubicon, consent: "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", - allowPI: true, allowGeo: false, allowID: true, }, @@ -415,16 +410,14 @@ func TestAllowPersonalInfoTCF2(t *testing.T) { description: "OpenX vendor test, Specific purposes/LIs claimed, no geo claimed, Publisher restrictions apply", bidder: openrtb_ext.BidderOpenx, consent: "CPAavcCPAavcCAGABCFRBKCsAP_AAH_AAAqIHFNf_X_fb3_j-_59_9t0eY1f9_7_v-0zjgeds-8Nyd_X_L8X5mM7vB36pq4KuR4Eu3LBAQdlHOHcTUmw6IkVqTPsbk2Mr7NKJ7PEinMbe2dYGH9_n9XT_ZKY79_____7__-_____7_f__-__3_vp9V---wOJAIMBAUAgAEMAAQIFCIQAAQhiQAAAABBCIBQJIAEqgAWVwEdoIEACAxAQgQAgBBQgwCAAQAAJKAgBACwQCAAiAQAAgAEAIAAEIAILACQEAAAEAJCAAiACECAgiAAg5DAgIgCCAFABAAAuJDACAMooASBAPGQGAAKAAqACGAEwALgAjgBlgDUAHZAPsA_ACMAFLAK2AbwBMQCbAFogLYAYEAw8BkQDOQGeAM-EQHwAVABWAC4AIYAZAAywBqADZAHYAPwAgABGAClgFPANYAdUA-QCGwEOgIvASIAmwBOwCkQFyAMCAYSAw8Bk4DOQGfCQAYADgBzgN_CQTgAEAALgAoACoAGQAOAAeABAACIAFQAMIAaABqADyAIYAigBMgCqAKwAWAAuABvADmAHoAQ0AiACJgEsAS4AmgBSgC3AGGAMgAZcA1ADVAGyAO8AewA-IB9gH6AQAAjABQQClgFPAL8AYoA1gBtADcAG8AOIAegA-QCGwEOgIqAReAkQBMQCZQE2AJ2AUOApEBYoC2AFyALvAYEAwYBhIDDQGHgMiAZIAycBlwDOQGfANIAadA1gDWQoAEAYQaBIACoAKwAXABDADIAGWANQAbIA7AB-AEAAIKARgApYBT4C0ALSAawA3gB1QD5AIbAQ6Ai8BIgCbAE7AKRAXIAwIBhIDDwGMAMnAZyAzwBnwcAEAA4Bv4qA2ABQAFQAQwAmABcAEcAMsAagA7AB-AEYAKXAWgBaQDeAJBATEAmwBTYC2AFyAMCAYeAyIBnIDPAGfANyHQWQAFwAUABUADIAHAAQAAiABdADAAMYAaABqADwAH0AQwBFACZAFUAVgAsABcADEAGYAN4AcwA9ACGAERAJYAmABNACjAFKALEAW4AwwBkADKAGiANQAbIA3wB3gD2gH2AfoBGACVAFBAKeAWKAtAC0gFzALyAX4AxQBuADiQHTAdQA9ACGwEOgIiAReAkEBIgCbAE7AKHAU0AqwBYsC2ALZAXAAuQBdoC7wGEgMNAYeAxIBjADHgGSAMnAZUAywBlwDOQGfANEgaQBpIDSwGnANYAbGPABAIqAb-QgZgALAAoABkAEQALgAYgBDACYAFUALgAYgAzABvAD0AI4AWIAygBqADfAHfAPsA_ACMAFBAKGAU-AtAC0gF-AMUAdQA9ACQQEiAJsAU0AsUBaMC2ALaAXAAuQBdoDDwGJAMiAZOAzkBngDPgGiANJAaWA4AlAyAAQAAsACgAGQAOAAigBgAGIAPAAiABMACqAFwAMQAZgA2gCGgEQARIAowBSgC3AGEAMoAaoA2QB3gD8AIwAU-AtAC0gGKANwAcQA6gCHQEXgJEATYAsUBbAC7QGHgMiAZOAywBnIDPAGfANIAawA4AmACARUA38pBBAAXABQAFQAMgAcABAACKAGAAYwA0ADUAHkAQwBFACYAFIAKoAWAAuABiADMAHMAQwAiABRgClAFiALcAZQA0QBqgDZAHfAPsA_ACMAFBAKGAVsAuYBeQDaAG4APQAh0BF4CRAE2AJ2AUOApoBWwCxQFsALgAXIAu0BhoDDwGMAMiAZIAycBlwDOQGeAM-gaQBpMDWANZAbGVABAA-Ab-A.YAAAAAAAAAAA", - allowPI: true, allowGeo: false, allowID: true, }, } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) + allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) - assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) assert.EqualValuesf(t, td.allowID, allowID, "AllowGeo failure on %s", td.description) } @@ -448,9 +441,8 @@ func TestAllowPersonalInfoWhitelistTCF2(t *testing.T) { } // Assert that an item that otherwise would not be allowed PI access, gets approved because it is found in the GDPR.NonStandardPublishers array perms.cfg.NonStandardPublisherMap = map[string]struct{}{"appNexusAppID": {}} - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), openrtb_ext.BidderAppnexus, "appNexusAppID", SignalYes, "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", false) + allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), openrtb_ext.BidderAppnexus, "appNexusAppID", SignalYes, "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA", false) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed") - assert.EqualValuesf(t, true, allowPI, "AllowPI failure") assert.EqualValuesf(t, true, allowGeo, "AllowGeo failure") assert.EqualValuesf(t, true, allowID, "AllowID failure") } @@ -479,7 +471,6 @@ func TestAllowPersonalInfoTCF2PubRestrict(t *testing.T) { description: "Appnexus vendor test, insufficient purposes claimed", bidder: openrtb_ext.BidderAppnexus, consent: "COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA", - allowPI: false, allowGeo: false, allowID: false, }, @@ -487,7 +478,6 @@ func TestAllowPersonalInfoTCF2PubRestrict(t *testing.T) { description: "Pubmatic vendor test, flex purposes claimed", bidder: openrtb_ext.BidderPubmatic, consent: "COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA", - allowPI: false, allowGeo: false, allowID: false, }, @@ -495,18 +485,16 @@ func TestAllowPersonalInfoTCF2PubRestrict(t *testing.T) { description: "Rubicon vendor test, Specific purposes/LIs claimed, no geo claimed", bidder: openrtb_ext.BidderRubicon, consent: "COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA", - allowPI: false, allowGeo: false, allowID: true, }, } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) + allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) - assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) - assert.EqualValuesf(t, td.allowID, allowID, "AllowPI failure on %s", td.description) + assert.EqualValuesf(t, td.allowID, allowID, "AllowID failure on %s", td.description) } } @@ -535,7 +523,6 @@ func TestAllowPersonalInfoTCF2PurposeOneTrue(t *testing.T) { description: "Appnexus vendor test, insufficient purposes claimed", bidder: openrtb_ext.BidderAppnexus, consent: "COzqiL3OzqiL3NIAAAENAiCMAP_AAH_AAIAAAQEX2S5MAICL7JcmAAA", - allowPI: false, allowGeo: false, allowID: false, }, @@ -543,7 +530,6 @@ func TestAllowPersonalInfoTCF2PurposeOneTrue(t *testing.T) { description: "Pubmatic vendor test, flex purposes claimed", bidder: openrtb_ext.BidderPubmatic, consent: "COzqiL3OzqiL3NIAAAENAiCMAP_AAH_AAIAAAQEX2S5MAICL7JcmAAA", - allowPI: true, allowGeo: true, allowID: true, }, @@ -551,16 +537,14 @@ func TestAllowPersonalInfoTCF2PurposeOneTrue(t *testing.T) { description: "Rubicon vendor test, Specific purposes/LIs claimed, no geo claimed", bidder: openrtb_ext.BidderRubicon, consent: "COzqiL3OzqiL3NIAAAENAiCMAP_AAH_AAIAAAQEX2S5MAICL7JcmAAA", - allowPI: true, allowGeo: false, allowID: true, }, } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) + allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) - assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) assert.EqualValuesf(t, td.allowID, allowID, "AllowID failure on %s", td.description) } @@ -592,7 +576,6 @@ func TestAllowPersonalInfoTCF2PurposeOneFalse(t *testing.T) { description: "Appnexus vendor test, insufficient purposes claimed", bidder: openrtb_ext.BidderAppnexus, consent: "COzqiL3OzqiL3NIAAAENAiCMAP_AAH_AAIAAAQEX2S5MAICL7JcmAAA", - allowPI: false, allowGeo: false, allowID: false, }, @@ -600,7 +583,6 @@ func TestAllowPersonalInfoTCF2PurposeOneFalse(t *testing.T) { description: "Pubmatic vendor test, flex purposes claimed", bidder: openrtb_ext.BidderPubmatic, consent: "COzqiL3OzqiL3NIAAAENAiCMAP_AAH_AAIAAAQEX2S5MAICL7JcmAAA", - allowPI: false, allowGeo: true, allowID: true, }, @@ -608,16 +590,14 @@ func TestAllowPersonalInfoTCF2PurposeOneFalse(t *testing.T) { description: "Rubicon vendor test, Specific purposes/LIs claimed, no geo claimed", bidder: openrtb_ext.BidderRubicon, consent: "COzqiL3OzqiL3NIAAAENAiCMAP_AAH_AAIAAAQEX2S5MAICL7JcmAAA", - allowPI: false, allowGeo: false, allowID: true, }, } for _, td := range testDefs { - allowPI, allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) + allowGeo, allowID, err := perms.PersonalInfoAllowed(context.Background(), td.bidder, "", SignalYes, td.consent, td.weakVendorEnforcement) assert.NoErrorf(t, err, "Error processing PersonalInfoAllowed for %s", td.description) - assert.EqualValuesf(t, td.allowPI, allowPI, "AllowPI failure on %s", td.description) assert.EqualValuesf(t, td.allowGeo, allowGeo, "AllowGeo failure on %s", td.description) assert.EqualValuesf(t, td.allowID, allowID, "AllowID failure on %s", td.description) }