Skip to content

Commit 934cb46

Browse files
committed
update after review
1 parent 6ba1166 commit 934cb46

File tree

6 files changed

+93
-80
lines changed

6 files changed

+93
-80
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class Banner {
1818
Integer pos
1919
List<String> mimes
2020
Integer topframe
21-
List<Integer> expdir
21+
@JsonProperty("expdir")
22+
List<Integer> expandableDirections
2223
List<Integer> api
2324
String id
2425
Integer vcm

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ class BidderParamsSpec extends BaseSpec {
10171017
and: "Response should contain seatBid"
10181018
assert response.seatbid.bid.flatten().size() == 1
10191019

1020-
and: "Bidder request should be valid"
1020+
and: "PBS should preform bidder request"
10211021
assert bidder.getBidderRequest(bidRequest.id)
10221022

10231023
and: "Response shouldn't contain error"
@@ -1058,7 +1058,7 @@ class BidderParamsSpec extends BaseSpec {
10581058
and: "Response should contain seatBid"
10591059
assert response.seatbid.bid.flatten().size() == 1
10601060

1061-
and: "Bidder request should be valid"
1061+
and: "PBS should preform bidder request"
10621062
assert bidder.getBidderRequest(bidRequest.id)
10631063

10641064
and: "Response shouldn't contain error"
@@ -1094,7 +1094,7 @@ class BidderParamsSpec extends BaseSpec {
10941094
and: "Response should contain seatBid"
10951095
assert response.seatbid.bid.flatten().size() == 1
10961096

1097-
and: "Bidder request should be valid"
1097+
and: "PBS should preform bidder request"
10981098
assert bidder.getBidderRequest(bidRequest.id)
10991099

11001100
and: "Response shouldn't contain error"
@@ -1182,7 +1182,7 @@ class BidderParamsSpec extends BaseSpec {
11821182
and: "Response should contain seatBid"
11831183
assert response.seatbid.bid.flatten().size() == 1
11841184

1185-
and: "Bidder request should be valid"
1185+
and: "PBS should preform bidder request"
11861186
assert bidder.getBidderRequest(bidRequest.id)
11871187

11881188
and: "Response shouldn't contain error"
@@ -1390,7 +1390,7 @@ class BidderParamsSpec extends BaseSpec {
13901390
then: "Response should contain adapter code"
13911391
assert response.seatbid.bid.ext.prebid.meta.adapterCode.flatten() == [BidderName.GENERIC]
13921392

1393-
and: "Bidder request should be valid"
1393+
and: "PBS should preform bidder request"
13941394
assert bidder.getBidderRequest(bidRequest.id)
13951395
}
13961396

@@ -1424,7 +1424,7 @@ class BidderParamsSpec extends BaseSpec {
14241424
and: "Response should contain repose millis with corresponding bidder"
14251425
assert response.ext.responsetimemillis.containsKey(ALIAS.value)
14261426

1427-
and: "Bidder request should be valid"
1427+
and: "PBS should preform bidder request"
14281428
assert bidder.getBidderRequests(bidRequest.id)
14291429
}
14301430

@@ -1462,7 +1462,7 @@ class BidderParamsSpec extends BaseSpec {
14621462
and: "Response should contain repose millis with corresponding bidder"
14631463
assert response.ext.responsetimemillis.containsKey(ALIAS.value)
14641464

1465-
and: "Bidder request should be valid"
1465+
and: "PBS should preform bidder request"
14661466
assert bidder.getBidderRequests(bidRequest.id)
14671467

14681468
cleanup: "Stop and remove pbs container"
@@ -1515,7 +1515,7 @@ class BidderParamsSpec extends BaseSpec {
15151515
and: "Response should contain repose millis with corresponding bidder"
15161516
assert response.ext.responsetimemillis.containsKey(ALIAS.value)
15171517

1518-
and: "Bidder request should be valid"
1518+
and: "PBS should preform bidder request"
15191519
assert bidder.getBidderRequests(bidRequest.id)
15201520

15211521
cleanup: "Stop and remove pbs container"
@@ -1552,7 +1552,7 @@ class BidderParamsSpec extends BaseSpec {
15521552
and: "Response should contain repose millis with corresponding bidder"
15531553
assert response.ext.responsetimemillis.containsKey(ALIAS_UPPER_CASE.value)
15541554

1555-
and: "Bidder request should be valid"
1555+
and: "PBS should preform bidder request"
15561556
assert bidder.getBidderRequests(bidRequest.id)
15571557
}
15581558

@@ -1612,7 +1612,7 @@ class BidderParamsSpec extends BaseSpec {
16121612
and: "Response should contain repose millis with corresponding bidder"
16131613
assert response.ext.responsetimemillis.containsKey(ALIAS_UPPER_CASE.value)
16141614

1615-
and: "Bidder request should be valid"
1615+
and: "PBS should preform bidder request"
16161616
assert bidder.getBidderRequests(bidRequest.id)
16171617
}
16181618

@@ -1652,7 +1652,7 @@ class BidderParamsSpec extends BaseSpec {
16521652
and: "Response should contain repose millis with corresponding bidder"
16531653
assert response.ext.responsetimemillis.containsKey(ALIAS.value)
16541654

1655-
and: "Bidder request should be valid"
1655+
and: "PBS should preform bidder request"
16561656
assert bidder.getBidderRequests(bidRequest.id)
16571657

16581658
cleanup: "Stop and remove pbs container"
@@ -1695,7 +1695,7 @@ class BidderParamsSpec extends BaseSpec {
16951695
and: "Response should contain repose millis with corresponding bidder"
16961696
assert response.ext.responsetimemillis.containsKey(ALIAS.value)
16971697

1698-
and: "Bidder request should be valid"
1698+
and: "PBS should preform bidder request"
16991699
assert bidder.getBidderRequests(bidRequest.id)
17001700

17011701
cleanup: "Stop and remove pbs container"
@@ -1735,7 +1735,7 @@ class BidderParamsSpec extends BaseSpec {
17351735
and: "Response should contain repose millis with corresponding bidder"
17361736
assert response.ext.responsetimemillis.containsKey(AMX.value)
17371737

1738-
and: "Bidder request should be valid"
1738+
and: "PBS should preform bidder request"
17391739
assert bidder.getBidderRequests(bidRequest.id)
17401740

17411741
cleanup: "Stop and remove pbs container"

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

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import org.prebid.server.functional.util.PBSUtils
1515
import spock.lang.PendingFeature
1616

1717
import java.nio.charset.StandardCharsets
18+
import java.time.Instant
1819

1920
import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID
2021

@@ -59,9 +60,9 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
5960
@PendingFeature
6061
def "PBS should remove invalid mimes from general get request when it's specified"() {
6162
given: "Default General get request"
62-
def validMemis = PBSUtils.randomString
63+
def validMimes = PBSUtils.randomString
6364
def generalGetRequest = GeneralGetRequest.default.tap {
64-
it.mimes = (invalidMimes + validMemis)
65+
it.mimes = (invalidMimes + validMimes)
6566
}
6667

6768
and: "Default stored request"
@@ -88,7 +89,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
8889
and: "Bidder request should contain mimes from param"
8990
def bidderRequest = bidder.getBidderRequest(request.id)
9091
assert bidderRequest.imp.size() == 1
91-
assert bidderRequest.imp.first.singleMediaTypeData.mimes == [validMemis]
92+
assert bidderRequest.imp.first.singleMediaTypeData.mimes == [validMimes]
9293

9394
where:
9495
invalidMimes << [[''], [PBSUtils.randomNumber.toString()]]
@@ -159,7 +160,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
159160
when: "PBS processes general get request"
160161
defaultPbsService.sendGeneralGetRequest(generalGetRequest)
161162

162-
then: "PBs should throw error due to invalid request"
163+
then: "PBS should throw error due to invalid request"
163164
def exception = thrown(PrebidServerException)
164165
assert exception.statusCode == 400
165166
assert exception.responseBody == 'Invalid request format: request.imp[0].banner has no sizes. Define "w" and "h", or include "format" elements'
@@ -190,7 +191,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
190191
when: "PBS processes general get request"
191192
defaultPbsService.sendGeneralGetRequest(generalGetRequest)
192193

193-
then: "PBs should throw error due to invalid request"
194+
then: "PBS should throw error due to invalid request"
194195
def exception = thrown(PrebidServerException)
195196
assert exception.statusCode == 400
196197
assert exception.responseBody == 'Invalid request format: request.imp[0].banner must define a valid "h" and "w" properties'
@@ -397,7 +398,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
397398
assert !response.ext?.errors
398399
assert !response.ext?.warnings
399400

400-
and: "Bidder request should contain width and height from param"
401+
and: "Bidder request should contain width and height from original stored request"
401402
def bidderRequest = bidder.getBidderRequest(request.id)
402403
assert bidderRequest.imp.size() == 1
403404
assert bidderRequest.imp.banner.format.width == request.imp.banner.format.width
@@ -428,7 +429,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
428429
when: "PBS processes general get request"
429430
defaultPbsService.sendGeneralGetRequest(generalGetRequest)
430431

431-
then: "PBs should throw error due to invalid request"
432+
then: "PBS should throw error due to invalid request"
432433
def exception = thrown(PrebidServerException)
433434
assert exception.statusCode == 400
434435
assert exception.responseBody == 'Invalid request format: request.imp[0].banner.format[0] should define *either* ' +
@@ -443,7 +444,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
443444
]
444445
}
445446

446-
def "PBS should apply slot from height general get request when it's specified"() {
447+
def "PBS should apply slot from general get request when it's specified"() {
447448
given: "Default General get request"
448449
def slotParam = PBSUtils.randomString
449450
def generalGetRequest = GeneralGetRequest.default.tap {
@@ -498,7 +499,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
498499
assert !response.ext?.errors
499500
assert !response.ext?.warnings
500501

501-
and: "Bidder request should contain mimes from param"
502+
and: "Bidder request should contain duration from param"
502503
def bidderRequest = bidder.getBidderRequest(request.id)
503504
assert bidderRequest.imp.singleMediaTypeData.minduration == [minDurationParam]
504505
assert bidderRequest.imp.singleMediaTypeData.maxduration == [maxDurationParam]
@@ -1300,7 +1301,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
13001301
assert !response.ext?.errors
13011302
assert !response.ext?.warnings
13021303

1303-
and: "Bidder request should contain playbackmethod from param"
1304+
and: "Bidder request should contain playbackend from param"
13041305
def bidderRequest = bidder.getBidderRequest(request.id)
13051306
assert bidderRequest.imp.first.video.playbackend == playbackEndParam
13061307
}
@@ -1426,7 +1427,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
14261427

14271428
and: "Bidder request should contain expdir from param"
14281429
def bidderRequest = bidder.getBidderRequest(request.id)
1429-
assert bidderRequest.imp.first.banner.expdir == expandableDirectionsParam
1430+
assert bidderRequest.imp.first.banner.expandableDirections == expandableDirectionsParam
14301431
}
14311432

14321433
def "PBS should apply topFrame from general get request when it's specified"() {
@@ -1472,7 +1473,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
14721473
it.banner.battr = [PBSUtils.randomNumber]
14731474
it.banner.pos = PBSUtils.randomNumber
14741475
it.banner.btype = [PBSUtils.randomNumber]
1475-
it.banner.expdir = [PBSUtils.randomNumber]
1476+
it.banner.expandableDirections = [PBSUtils.randomNumber]
14761477
it.banner.topframe = PBSUtils.randomNumber
14771478
}
14781479
def request = BidRequest.getDefaultBidRequest().tap {
@@ -1504,7 +1505,7 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
15041505
it.battr == bannerImp.banner.battr
15051506
it.pos == bannerImp.banner.pos
15061507
it.btype == bannerImp.banner.btype
1507-
it.expdir == bannerImp.banner.expdir
1508+
it.expandableDirections == bannerImp.banner.expandableDirections
15081509
it.topframe == bannerImp.banner.topframe
15091510
}
15101511
}
@@ -1700,33 +1701,41 @@ class GeneralGetInterfaceImpSpec extends BaseSpec {
17001701
def storedRequest = StoredRequest.getStoredRequest(generalGetRequest.storedRequestId, bidRequest)
17011702
storedRequestDao.save(storedRequest)
17021703

1703-
when: "PBS processes amp request"
1704+
when: "PBS processes general get request"
17041705
defaultPbsService.sendGeneralGetRequest(generalGetRequest)
17051706

1706-
then: "Amp response should contain value from targeting in imp.ext.data"
1707+
then: "General get response should contain value from targeting in imp.ext.data"
17071708
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
17081709
assert bidderRequest.imp[0].ext.data.any == targeting.any
17091710
}
17101711

17111712
def "PBS should throw exception when general get request linked to stored request with several imps"() {
1712-
given: "Stored request with several imps"
1713+
given: "Start time"
1714+
def startTime = Instant.now()
1715+
1716+
and: "Stored request with several imps"
17131717
def request = BidRequest.getDefaultBidRequest().tap {
17141718
addImp(Imp.defaultImpression)
1715-
setAccountId(accountId)
1719+
setAccountId(generalGetRequest.resolveStoredRequestId())
17161720
}
17171721

17181722
and: "Save storedRequest into DB"
17191723
def storedRequest = StoredRequest.getStoredRequest(generalGetRequest.resolveStoredRequestId(), request)
17201724
storedRequestDao.save(storedRequest)
17211725

17221726
when: "PBS processes general get request"
1723-
defaultPbsService.sendGeneralGetRequest(generalGetRequest)
1727+
def response = defaultPbsService.sendGeneralGetRequest(generalGetRequest)
17241728

1725-
then: "PBs should throw error due to invalid request"
1726-
def exception = thrown(PrebidServerException)
1727-
assert exception.statusCode == 400
1728-
assert exception.responseBody == "data for tag_id '${generalGetRequest.resolveStoredRequestId()}' includes '${request.imp.size()}'" +
1729-
" imp elements. Only one is allowed"
1729+
then: "Response should not contain errors and warnings"
1730+
assert !response.ext?.errors
1731+
assert !response.ext?.warnings
1732+
1733+
and: "Bidder request should contain only first imp data"
1734+
assert bidder.getBidderRequest(request.id).imp.id == [request.imp.first.id]
1735+
1736+
and: "PBS log should contain message"
1737+
def logs = defaultPbsService.getLogsByTime(startTime)
1738+
assert getLogsByText(logs, '').size() == 1 //TODO add logs
17301739

17311740
where:
17321741
generalGetRequest << [

0 commit comments

Comments
 (0)