Skip to content

Commit 0d96d11

Browse files
authored
Increase profiles test coverage (#4181)
1 parent c17c3fb commit 0d96d11

File tree

12 files changed

+212
-77
lines changed

12 files changed

+212
-77
lines changed

src/test/groovy/org/prebid/server/functional/model/request/auction/Banner.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Banner {
1010

1111
List<Format> format
1212
@JsonProperty("w")
13-
Integer weight
13+
Integer width
1414
@JsonProperty("h")
1515
Integer height
1616
List<Integer> btype

src/test/groovy/org/prebid/server/functional/model/request/auction/Format.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@ import org.prebid.server.functional.util.PBSUtils
1010
class Format {
1111

1212
@JsonProperty("w")
13-
Integer weight
13+
Integer width
1414
@JsonProperty("h")
1515
Integer height
1616
@JsonProperty("wratio")
17-
Integer weightRatio
17+
Integer widthRatio
1818
@JsonProperty("hratio")
1919
Integer heightRatio
2020
@JsonProperty("wmin")
21-
Integer weightMin
21+
Integer widthMin
2222

2323
static Format getDefaultFormat() {
2424
new Format().tap {
25-
weight = 300
25+
width = 300
2626
height = 250
2727
}
2828
}
2929

3030
static Format getRandomFormat() {
3131
new Format().tap {
32-
weight = PBSUtils.randomNumber
32+
width = PBSUtils.randomNumber
3333
height = PBSUtils.randomNumber
3434
}
3535
}

src/test/groovy/org/prebid/server/functional/model/request/auction/Video.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Video {
1616
Integer poddur
1717
List<Integer> protocols
1818
@JsonProperty("w")
19-
Integer weight
19+
Integer width
2020
@JsonProperty("h")
2121
Integer height
2222
Integer podid
@@ -47,6 +47,6 @@ class Video {
4747
List<Integer> podDeduplication
4848

4949
static Video getDefaultVideo() {
50-
new Video(mimes: ["video/mp4"], weight: 300, height: 200)
50+
new Video(mimes: ["video/mp4"], width: 300, height: 200)
5151
}
5252
}

src/test/groovy/org/prebid/server/functional/model/response/auction/Bid.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class Bid implements ObjectMapperWrapper {
4040
String langb
4141
String dealid
4242
@JsonProperty("w")
43-
Integer weight
43+
Integer width
4444
@JsonProperty("h")
4545
Integer height
4646
@JsonProperty("wratio")
47-
Integer weightRatio
47+
Integer widthRatio
4848
@JsonProperty("hratio")
4949
Integer heightRatio
5050
Integer exp
@@ -65,7 +65,7 @@ class Bid implements ObjectMapperWrapper {
6565
price = imp.bidFloor != null ? imp.bidFloor : PBSUtils.getRandomPrice()
6666
crid = 1
6767
height = imp.banner && imp.banner.format ? imp.banner.format.first().height : null
68-
weight = imp.banner && imp.banner.format ? imp.banner.format.first().weight : null
68+
width = imp.banner && imp.banner.format ? imp.banner.format.first().width : null
6969
if (imp.nativeObj || imp.video) {
7070
adm = new Adm(assets: [Asset.defaultAsset])
7171
}

src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ LIMIT 1
3838
"settings.database.account-query" : DB_ACCOUNT_QUERY,
3939
"settings.database.stored-requests-query" : "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%) UNION ALL SELECT accountId, impId, impData, 'imp' as dataType FROM stored_imps WHERE impId IN (%IMP_ID_LIST%)",
4040
"settings.database.amp-stored-requests-query": "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%)",
41-
"settings.database.stored-responses-query" : "SELECT resId, COALESCE(storedAuctionResponse, storedBidResponse) as responseData FROM stored_responses WHERE resId IN (%RESPONSE_ID_LIST%)",
42-
'settings.database.profiles-query' : "SELECT accountId, profileId, profile, mergePrecedence, type FROM profiles WHERE profileId in (%REQUEST_ID_LIST%, %IMP_ID_LIST%)"
41+
"settings.database.stored-responses-query" : "SELECT resId, COALESCE(storedAuctionResponse, storedBidResponse) as responseData FROM stored_responses WHERE resId IN (%RESPONSE_ID_LIST%)"
4342
].asImmutable()
4443

4544
static Map<String, String> getPubstackAnalyticsConfig(String scopeId) {

src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Bidder extends NetworkScaffolding {
7575
def formatNode = it.get("banner") != null ? it.get("banner").get("format") : null
7676
new Imp(id: it.get("id").asText(),
7777
banner: formatNode != null
78-
? new Banner(format: [new Format(weight: formatNode.first().get("w").asInt(), height: formatNode.first().get("h").asInt())])
78+
? new Banner(format: [new Format(width: formatNode.first().get("w").asInt(), height: formatNode.first().get("h").asInt())])
7979
: null)}
8080
def bidRequest = new BidRequest(id: id, imp: imps)
8181
def response = BidResponse.getDefaultBidResponse(bidRequest)

src/test/groovy/org/prebid/server/functional/tests/AmpSpec.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class AmpSpec extends BaseSpec {
8787
then: "Response should contain information from stored response"
8888
def price = storedAuctionResponse.bid[0].price
8989
assert response.targeting["hb_pb"] == getRoundedTargetingValueWithDownPrecision(price)
90-
assert response.targeting["hb_size"] == "${storedAuctionResponse.bid[0].weight}x${storedAuctionResponse.bid[0].height}"
90+
assert response.targeting["hb_size"] == "${storedAuctionResponse.bid[0].width}x${storedAuctionResponse.bid[0].height}"
9191

9292
and: "PBS not send request to bidder"
9393
assert bidder.getRequestCount(ampStoredRequest.id) == 0
@@ -126,7 +126,7 @@ class AmpSpec extends BaseSpec {
126126
assert bidderRequest.site?.publisher?.id == ampRequest.account.toString()
127127
assert bidderRequest.imp[0]?.tagId == ampRequest.slot
128128
assert bidderRequest.imp[0]?.banner?.format*.height == [ampRequest.h, msH]
129-
assert bidderRequest.imp[0]?.banner?.format*.weight == [ampRequest.w, msW]
129+
assert bidderRequest.imp[0]?.banner?.format*.width == [ampRequest.w, msW]
130130
assert bidderRequest.regs?.gdpr == (ampRequest.gdprApplies ? 1 : 0)
131131
}
132132

@@ -154,7 +154,7 @@ class AmpSpec extends BaseSpec {
154154
def bidderRequest = bidder.getBidderRequest(ampStoredRequest.id)
155155

156156
assert bidderRequest.imp[0]?.banner?.format*.height == [ampRequest.oh]
157-
assert bidderRequest.imp[0]?.banner?.format*.weight == [ampRequest.ow]
157+
assert bidderRequest.imp[0]?.banner?.format*.width == [ampRequest.ow]
158158
}
159159

160160
def "PBS should take parameters from the stored request when it's not specified in the request"() {
@@ -180,7 +180,7 @@ class AmpSpec extends BaseSpec {
180180
assert bidderRequest.site?.publisher?.id == ampStoredRequest.site.publisher.id
181181
assert !bidderRequest.imp[0]?.tagId
182182
assert bidderRequest.imp[0]?.banner?.format[0]?.height == ampStoredRequest.imp[0].banner.format[0].height
183-
assert bidderRequest.imp[0]?.banner?.format[0]?.weight == ampStoredRequest.imp[0].banner.format[0].weight
183+
assert bidderRequest.imp[0]?.banner?.format[0]?.width == ampStoredRequest.imp[0].banner.format[0].width
184184
assert bidderRequest.regs?.gdpr == ampStoredRequest.regs.gdpr
185185
}
186186

0 commit comments

Comments
 (0)