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

Add additional tests case for cookie sync spec #2881

Merged
merged 3 commits into from
Jan 15, 2024
Merged
Changes from all commits
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
Expand Up @@ -15,6 +15,7 @@ import org.prebid.server.functional.model.request.cookiesync.FilterSettings
import org.prebid.server.functional.model.request.cookiesync.MethodFilter
import org.prebid.server.functional.model.response.cookiesync.CookieSyncResponse
import org.prebid.server.functional.model.response.cookiesync.UserSyncInfo
import org.prebid.server.functional.service.PrebidServerException
import org.prebid.server.functional.service.PrebidServerService
import org.prebid.server.functional.util.HttpUtil
import org.prebid.server.functional.util.PBSUtils
Expand Down Expand Up @@ -1432,7 +1433,7 @@ class CookieSyncSpec extends BaseSpec {
assert response.bidderStatus.bidder.containsAll(ADKERNEL, ACUITYADS, ACEEX, APPNEXUS, AAX, RUBICON, OPENX, GENERIC)
}

def "PBS cookie sync request should return bidder"() {
def "PBS cookie sync request shouldn't return bidder due to filter setting request"() {
given: "Cookie sync request with filter setting"
def filterSettings = new FilterSettings().tap {
image = new MethodFilter().tap {
Expand Down Expand Up @@ -2154,6 +2155,21 @@ class CookieSyncSpec extends BaseSpec {
accountCoopSyncConfig << [false, true, null]
}

def "PBS cookie sync request should respond with an error when gdpr param is 1 and consent isn't specified"() {
given: "Cookie sync request body with gdpr = 1 and gdprConsent = null"
def cookieSyncRequest = new CookieSyncRequest().tap {
gdpr = 1
gdprConsent = null
}

when: "PBS processes cookie sync request"
prebidServerService.sendCookieSyncRequest(cookieSyncRequest)

then: "Response should contain error"
def serverException = thrown(PrebidServerException)
assert serverException.responseBody == "Invalid request format: gdpr_consent is required if gdpr is 1"
}

private static Map<BidderName, UserSyncInfo> getValidBidderUserSyncs(CookieSyncResponse cookieSyncResponse) {
cookieSyncResponse.bidderStatus
.findAll { it.userSync }
Expand Down
Loading