From 08fc6fd6566a3089489ec7019501ed5d2e29912c Mon Sep 17 00:00:00 2001 From: markiian Date: Fri, 5 Jan 2024 14:06:39 +0200 Subject: [PATCH 1/3] Add additional tests case for cookie sync spec --- .../functional/tests/CookieSyncSpec.groovy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy index 28b6ac5a591..bb66e44e77a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy @@ -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 @@ -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 no consent is 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 getValidBidderUserSyncs(CookieSyncResponse cookieSyncResponse) { cookieSyncResponse.bidderStatus .findAll { it.userSync } From d2ac29591f1d8cc9572813dadd4449f2e111d9d4 Mon Sep 17 00:00:00 2001 From: markiian Date: Fri, 5 Jan 2024 14:07:52 +0200 Subject: [PATCH 2/3] Update typo --- .../org/prebid/server/functional/tests/CookieSyncSpec.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy index bb66e44e77a..6934cebd034 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy @@ -2155,7 +2155,7 @@ class CookieSyncSpec extends BaseSpec { accountCoopSyncConfig << [false, true, null] } - def "PBS cookie sync request should respond with an error when gdpr param is 1 and no consent is specified"() { + 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 From c1139a10390fe1fb75856c0eda29e7e452faf9ea Mon Sep 17 00:00:00 2001 From: markiian Date: Fri, 5 Jan 2024 14:09:21 +0200 Subject: [PATCH 3/3] Update typo --- .../org/prebid/server/functional/tests/CookieSyncSpec.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy index 6934cebd034..b3739974247 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy @@ -1433,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 {