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

Tests: Eidpermissions Request Validation Update #3688

Merged
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
55 changes: 55 additions & 0 deletions src/test/groovy/org/prebid/server/functional/tests/EidsSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import org.prebid.server.functional.util.PBSUtils
import static org.prebid.server.functional.model.bidder.BidderName.ALIAS
import static org.prebid.server.functional.model.bidder.BidderName.GENERIC
import static org.prebid.server.functional.model.bidder.BidderName.OPENX
import static org.prebid.server.functional.model.bidder.BidderName.UNKNOWN
import static org.prebid.server.functional.model.bidder.BidderName.WILDCARD
import static org.prebid.server.functional.model.request.auction.DebugCondition.DISABLED
import static org.prebid.server.functional.model.request.auction.DebugCondition.ENABLED
import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID
import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer

Expand Down Expand Up @@ -91,6 +94,58 @@ class EidsSpec extends BaseSpec {
assert !bidderRequest.user.eids
}

def "PBS eids shouldn't include warning for unknown bidder in request"() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PBS eids shouldn't include warning for unknown bidder when test and debug disabled

given: "Default bid request with generic bidder"
def sourceId = PBSUtils.randomString
def eids = [new Eid(source: sourceId, uids: [new Uid(id: sourceId)])]
def bidRequest = BidRequest.defaultBidRequest.tap {
user = new User(eids: eids)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add please to the test ext.eids = eids and for the second test too.

ext.prebid.data = new ExtRequestPrebidData(eidpermissions: [new EidPermission(source: sourceId, bidders: [UNKNOWN])])
it.ext.prebid.debug = DISABLED
it.test = DISABLED
}

when: "PBS processes auction request"
def bidResponse = defaultPbsService.sendAuctionRequest(bidRequest)

then: "Bidder request shouldn't contain requested eids"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert !bidderRequest.user.eids

and: "Bid response shouldn't contain warning"
assert !bidResponse.ext.warnings
}

def "PBS eids should include warning for unknown bidder when request in debug mode"() {
given: "Default bid request with generic bidder"
def sourceId = PBSUtils.randomString
def eids = [new Eid(source: sourceId, uids: [new Uid(id: sourceId)])]
def bidRequest = BidRequest.defaultBidRequest.tap {
user = new User(eids: eids)
ext.prebid.data = new ExtRequestPrebidData(eidpermissions: [new EidPermission(source: sourceId, bidders: [UNKNOWN])])
it.ext.prebid.debug = debug
it.test = test
}

when: "PBS processes auction request"
def bidResponse = defaultPbsService.sendAuctionRequest(bidRequest)

then: "Bidder request shouldn't contain requested eids"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert !bidderRequest.user.eids

and: "Bid response should contain warning"
assert bidResponse.ext.warnings[PREBID]?.code == [999]
assert bidResponse.ext.warnings[PREBID]?.message ==
["request.ext.prebid.data.eidPermissions[].bidders[] unrecognized biddercode: '$UNKNOWN'"]

where:
debug | test
DISABLED | ENABLED
ENABLED | DISABLED
ENABLED | ENABLED
}

def "PBs eid permissions should affect only specified on source"() {
given: "PBs with openx bidder"
def pbsService = pbsServiceFactory.getService(
Expand Down
Loading