-
Notifications
You must be signed in to change notification settings - Fork 187
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 functional tests for support testing label header #2963
Add functional tests for support testing label header #2963
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this requirement ?
@@ -141,6 +142,16 @@ class PrebidServerService implements ObjectMapperWrapper { | |||
response.as(CookieSyncResponse) | |||
} | |||
|
|||
@Step("[POST RAW] /cookie_sync with uids cookies") | |||
RawCookieSyncResponse sendCookieSyncRequestRaw(CookieSyncRequest request, UidsCookie uidsCookie) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please place those methods in order overloads
@@ -89,6 +91,8 @@ class CookieSyncSpec extends BaseSpec { | |||
private static final Map<String, String> ACUITYADS_CONFIG = ["adapters.${ACUITYADS.value}.enabled": "true"] | |||
private static final Map<String, String> ADKERNEL_CONFIG = ["adapters.${ADKERNEL.value}.enabled": "true"] | |||
|
|||
private static final def SET_COOKIE_HEADER = 'Set-Cookie' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move upper to the rest constant.
def uidsCookie = UidsCookie.defaultUidsCookie | ||
|
||
and: "Save account with cookie and privacySandbox configs" | ||
def cookieSyncConfig = new AccountCookieSyncConfig(defaultLimit: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope we can remove AccountCookieSyncConfig
since it doesn't affect our logic
def accountConfig = new AccountConfig(status: AccountStatus.ACTIVE, cookieSync: cookieSyncConfig, auction: accountAuctionConfig) | ||
def account = new Account(uuid: accountId, config: accountConfig) | ||
accountDao.save(account) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove redundant empty line
and: "Set up generic uids cookie" | ||
def uidsCookie = UidsCookie.defaultUidsCookie |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one also can be removed
PrivacySandbox.getDefaultPrivacySandbox(true, -PBSUtils.randomNumber), | ||
PrivacySandbox.getDefaultPrivacySandbox(true, null)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that two conditions shouldn't work?
def uidsCookie = UidsCookie.defaultUidsCookie | ||
|
||
and: "Save account with cookie and privacySandbox configs" | ||
def cookieSyncConfig = new AccountCookieSyncConfig(defaultLimit: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AccountCookieSyncConfig
can be removed
def accountConfig = new AccountConfig(status: AccountStatus.ACTIVE, cookieSync: cookieSyncConfig, auction: accountAuctionConfig) | ||
def account = new Account(uuid: accountId, config: accountConfig) | ||
accountDao.save(account) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same empty line
assert response.headers[SET_COOKIE_HEADER] == getCookieDeprecationHeader(privacySandbox.cookieDeprecation.ttlSeconds) | ||
} | ||
|
||
def "PBS should set cookie deprecation header from the default account when the accountId from the request is not matched"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when default account contain privacy sandbox
and: "Sec-Cookie-Deprecation header" | ||
def secCookieDeprecation = [(COOKIE_DEPRECATION_HEADER): PBSUtils.randomString] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't really need set sec-cookie-deprecation header when privacy sandbox is null or false
when: "PBS processes auction request with header" | ||
defaultPbsService.sendAuctionRequest(bidRequest, secCookieDeprecation) | ||
|
||
then: "BidResponse should have device.ext.cdep from sec-cookie-deprecation header" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably BidderRequest should have...
, please check other places
assert bidderRequest.device.ext.cdep == secCookieDeprecation[COOKIE_DEPRECATION_HEADER] | ||
} | ||
|
||
def "PBS should set device.ext.cdep from header when default account don't contain privacy sandbox and request account is empty"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not
def response = prebidServerService.sendCookieSyncRequestRaw(cookieSyncRequest, uidsCookie) | ||
|
||
then: "Response should contain cookie header" | ||
assert extractCookieParameter(response.headers[SET_COOKIE_HEADER], 'Max-Age') == TimeUnit.DAYS.toSeconds(7) as Integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see any test that check the whole set-cookie header value
assert extractCookieParameter(response.headers[SET_COOKIE_HEADER], 'Max-Age') == privacySandbox.cookieDeprecation.ttlSeconds | ||
} | ||
|
||
def "PBS shouldn't set cookie deprecation header when default account don't contain privacy sandbox and request account is empty"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just when cookie sync request doesn't contain account
No description provided.