-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename integration to channel in account config tests
- Loading branch information
mtuchkova
committed
Nov 29, 2021
1 parent
b9cac43
commit 459e658
Showing
15 changed files
with
603 additions
and
140 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...unctional/model/config/ChannelType.groovy → ...erver/functional/model/ChannelType.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/test/groovy/org/prebid/server/functional/model/config/AccountCcpaConfig.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
package org.prebid.server.functional.model.config | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming | ||
import groovy.transform.ToString | ||
import org.prebid.server.functional.model.ChannelType | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy) | ||
class AccountCcpaConfig { | ||
|
||
Boolean enabled | ||
@JsonProperty("channel-enabled") | ||
Map<ChannelType, Boolean> enabledForRequestType | ||
} |
3 changes: 3 additions & 0 deletions
3
src/test/groovy/org/prebid/server/functional/model/config/AccountGdprConfig.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/test/groovy/org/prebid/server/functional/model/request/auction/Channel.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package org.prebid.server.functional.model.request.auction | ||
|
||
import groovy.transform.ToString | ||
import org.prebid.server.functional.model.ChannelType | ||
|
||
@ToString(includeNames = true, ignoreNulls = true) | ||
class Channel { | ||
|
||
String name | ||
ChannelType name | ||
String version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 152 additions & 0 deletions
152
src/test/groovy/org/prebid/server/functional/tests/privacy/CcpaAmpSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
package org.prebid.server.functional.tests.privacy | ||
|
||
import org.prebid.server.functional.model.bidder.BidderName | ||
import org.prebid.server.functional.model.config.AccountCcpaConfig | ||
import org.prebid.server.functional.model.config.AccountConfig | ||
import org.prebid.server.functional.model.config.AccountPrivacyConfig | ||
import org.prebid.server.functional.model.db.Account | ||
import org.prebid.server.functional.model.db.StoredRequest | ||
import org.prebid.server.functional.testcontainers.PBSTest | ||
import org.prebid.server.functional.util.privacy.BogusConsent | ||
import org.prebid.server.functional.util.privacy.CcpaConsent | ||
import spock.lang.PendingFeature | ||
import spock.lang.Unroll | ||
|
||
import static org.prebid.server.functional.model.ChannelType.AMP | ||
import static org.prebid.server.functional.util.privacy.CcpaConsent.Signal.ENFORCED | ||
|
||
@PBSTest | ||
class CcpaAmpSpec extends PrivacyBaseSpec { | ||
|
||
@PendingFeature | ||
def "PBS should add debug log for amp request when valid ccpa was passed"() { | ||
given: "Default AmpRequest" | ||
def validCcpa = new CcpaConsent(explicitNotice: ENFORCED, optOutSale: ENFORCED) | ||
def ampRequest = getCcpaAmpRequest(validCcpa) | ||
|
||
and: "Save storedRequest into DB" | ||
def ampStoredRequest = storedRequestWithGeo | ||
def storedRequest = StoredRequest.getDbStoredRequest(ampRequest, ampStoredRequest) | ||
storedRequestDao.save(storedRequest) | ||
|
||
when: "PBS processes amp request" | ||
def response = defaultPbsService.sendAmpRequest(ampRequest) | ||
|
||
then: "Response should contain debug log" | ||
assert response.ext?.debug?.privacy | ||
def privacy = response.ext?.debug?.privacy | ||
|
||
verifyAll { | ||
privacy.originPrivacy?.ccpa?.usPrivacy == validCcpa as String | ||
privacy.resolvedPrivacy?.ccpa?.usPrivacy == validCcpa as String | ||
|
||
!privacy.originPrivacy?.coppa?.coppa | ||
!privacy.resolvedPrivacy?.coppa?.coppa | ||
|
||
!privacy.originPrivacy?.tcf?.gdpr | ||
!privacy.originPrivacy?.tcf?.tcfConsentString | ||
!privacy.originPrivacy?.tcf?.tcfConsentVersion | ||
!privacy.originPrivacy?.tcf?.inEea | ||
!privacy.resolvedPrivacy?.tcf?.gdpr | ||
!privacy.resolvedPrivacy?.tcf?.tcfConsentString | ||
!privacy.resolvedPrivacy?.tcf?.tcfConsentVersion | ||
!privacy.resolvedPrivacy?.tcf?.inEea | ||
|
||
privacy.privacyActionsPerBidder[BidderName.GENERIC] == | ||
["Geolocation was masked in request to bidder according to CCPA policy."] | ||
|
||
privacy.errors?.isEmpty() | ||
} | ||
} | ||
|
||
@PendingFeature | ||
def "PBS should add debug log for amp request when invalid ccpa was passed"() { | ||
given: "Default AmpRequest" | ||
def invalidCcpa = new BogusConsent() | ||
def ampRequest = getCcpaAmpRequest(invalidCcpa) | ||
|
||
and: "Save storedRequest into DB" | ||
def ampStoredRequest = storedRequestWithGeo | ||
def storedRequest = StoredRequest.getDbStoredRequest(ampRequest, ampStoredRequest) | ||
storedRequestDao.save(storedRequest) | ||
|
||
when: "PBS processes amp request" | ||
def response = defaultPbsService.sendAmpRequest(ampRequest) | ||
|
||
then: "Response should not contain error" | ||
assert !response.ext?.errors | ||
|
||
and: "Response should contain debug log with error" | ||
assert response.ext?.debug?.privacy | ||
def privacy = response.ext?.debug?.privacy | ||
|
||
verifyAll { | ||
privacy.originPrivacy?.ccpa?.usPrivacy == invalidCcpa as String | ||
privacy.resolvedPrivacy?.ccpa?.usPrivacy == invalidCcpa as String | ||
|
||
privacy.privacyActionsPerBidder[BidderName.GENERIC].isEmpty() | ||
|
||
privacy.errors == | ||
["Amp request parameter consent_string or gdpr_consent have invalid format: $invalidCcpa" as String] | ||
} | ||
} | ||
|
||
@Unroll | ||
def "PBS should apply ccpa when privacy.ccpa.channel-enabled.amp or privacy.ccpa.enabled = true in account config"() { | ||
given: "Default AmpRequest" | ||
def validCcpa = new CcpaConsent(explicitNotice: ENFORCED, optOutSale: ENFORCED) | ||
def ampRequest = getCcpaAmpRequest(validCcpa) | ||
|
||
and: "Save storedRequest into DB" | ||
def ampStoredRequest = storedRequestWithGeo | ||
def storedRequest = StoredRequest.getDbStoredRequest(ampRequest, ampStoredRequest) | ||
storedRequestDao.save(storedRequest) | ||
|
||
and: "Save account config into DB" | ||
def privacy = new AccountPrivacyConfig(ccpa: ccpaConfig) | ||
def accountConfig = new AccountConfig(privacy: privacy) | ||
def account = new Account(uuid: ampRequest.account, config: accountConfig) | ||
accountDao.save(account) | ||
|
||
when: "PBS processes amp request" | ||
defaultPbsService.sendAmpRequest(ampRequest) | ||
|
||
then: "Bidder request should contain masked values" | ||
def bidderRequests = bidder.getBidderRequest(ampStoredRequest.id) | ||
assert bidderRequests.device?.geo == maskGeo(ampStoredRequest) | ||
|
||
where: | ||
ccpaConfig << [new AccountCcpaConfig(enabled: false, enabledForRequestType: [(AMP): true]), | ||
new AccountCcpaConfig(enabled: true)] | ||
} | ||
|
||
@Unroll | ||
def "PBS should not apply ccpa when privacy.ccpa.channel-enabled.amp or privacy.ccpa.enabled = false in account config"() { | ||
given: "Default AmpRequest" | ||
def validCcpa = new CcpaConsent(explicitNotice: ENFORCED, optOutSale: ENFORCED) | ||
def ampRequest = getCcpaAmpRequest(validCcpa) | ||
|
||
and: "Save storedRequest into DB" | ||
def ampStoredRequest = storedRequestWithGeo | ||
def storedRequest = StoredRequest.getDbStoredRequest(ampRequest, ampStoredRequest) | ||
storedRequestDao.save(storedRequest) | ||
|
||
and: "Save account config into DB" | ||
def privacy = new AccountPrivacyConfig(ccpa: ccpaConfig) | ||
def accountConfig = new AccountConfig(privacy: privacy) | ||
def account = new Account(uuid: ampRequest.account, config: accountConfig) | ||
accountDao.save(account) | ||
|
||
when: "PBS processes amp request" | ||
defaultPbsService.sendAmpRequest(ampRequest) | ||
|
||
then: "Bidder request should contain not masked values" | ||
def bidderRequests = bidder.getBidderRequest(ampStoredRequest.id) | ||
assert bidderRequests.device?.geo?.lat == ampStoredRequest.device.geo.lat | ||
assert bidderRequests.device?.geo?.lon == ampStoredRequest.device.geo.lon | ||
|
||
where: | ||
ccpaConfig << [new AccountCcpaConfig(enabled: true, enabledForRequestType: [(AMP): false]), | ||
new AccountCcpaConfig(enabled: false)] | ||
} | ||
} |
Oops, something went wrong.