Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: consented_providers_settings #3577

Merged
merged 6 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy)
class ConsentedProvidersSettings {

String consentedProviders
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.prebid.server.functional.model.request.auction

import com.fasterxml.jackson.annotation.JsonProperty
import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
Expand All @@ -11,6 +12,8 @@ class UserExt {
UserTime time
UserExtData data
UserExtPrebid prebid
@JsonProperty("consented_providers_settings")
ConsentedProvidersSettings consentedProvidersSettings

static UserExt getFPDUserExt() {
new UserExt(data: UserExtData.FPDUserExtData)
Expand Down
39 changes: 39 additions & 0 deletions src/test/groovy/org/prebid/server/functional/tests/AmpSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,43 @@ class AmpSpec extends BaseSpec {
assert bidderRequest.imp[0]?.banner?.format[0]?.weight == ampStoredRequest.imp[0].banner.format[0].weight
assert bidderRequest.regs?.gdpr == ampStoredRequest.regs.gdpr
}

def "PBS should pass addtl_consent to user.ext.consented_providers_settings.consented_providers"() {
given: "Default amp request with addtlConsent"
def randomAddtlConsent = PBSUtils.randomString
def ampRequest = AmpRequest.defaultAmpRequest.tap {
addtlConsent = randomAddtlConsent
}

and: "Save storedRequest into DB"
def ampStoredRequest = BidRequest.defaultBidRequest
def storedRequest = StoredRequest.getStoredRequest(ampRequest, ampStoredRequest)
storedRequestDao.save(storedRequest)

when: "PBS processes amp request"
defaultPbsService.sendAmpRequest(ampRequest)

then: "Bidder request should contain addtl consent"
def bidderRequest = bidder.getBidderRequest(ampStoredRequest.id)
assert bidderRequest.user.ext.consentedProvidersSettings.consentedProviders == randomAddtlConsent
}

def "PBS shouldn't pass addtl_consent to user.ext.consented_providers_settings.consented_providers when addtl_consent not specified"() {
given: "Default amp request without addtl_consent"
def ampRequest = AmpRequest.defaultAmpRequest.tap {
addtlConsent = null
}

and: "Save storedRequest into DB"
def ampStoredRequest = BidRequest.defaultBidRequest
def storedRequest = StoredRequest.getStoredRequest(ampRequest, ampStoredRequest)
storedRequestDao.save(storedRequest)

when: "PBS processes amp request"
defaultPbsService.sendAmpRequest(ampRequest)

then: "Bidder request shouldn't contain addtl consent"
def bidderRequest = bidder.getBidderRequest(ampStoredRequest.id)
assert !bidderRequest.user.ext.consentedProvidersSettings.consentedProviders
}
}
Loading