Skip to content

Commit d008aed

Browse files
committed
Update tests
1 parent ce9a909 commit d008aed

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class AuctionSpec extends BaseSpec {
5656

5757
private static final String IMPS_REQUESTED_METRIC = 'imps_requested'
5858
private static final String IMPS_DROPPED_METRIC = 'imps_dropped'
59+
private static final Integer IMP_LIMIT = 1
5960
private static final Map<String, String> PBS_CONFIG = ["auction.biddertmax.max" : MAX_TIMEOUT as String,
6061
"auction.default-timeout-ms": DEFAULT_TIMEOUT as String]
6162

@@ -732,7 +733,7 @@ class AuctionSpec extends BaseSpec {
732733
}
733734

734735
and: "Account in the DB with impression limit config"
735-
def impressionLimit = 1
736+
736737
def accountConfig = new AccountConfig(auction: accountAuctionConfig)
737738
def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig)
738739
accountDao.save(account)
@@ -749,24 +750,24 @@ class AuctionSpec extends BaseSpec {
749750
and: "PBS should emit an warning"
750751
assert response.ext?.warnings[PREBID]*.code == [999]
751752
assert response.ext?.warnings[PREBID]*.message ==
752-
["Only first $impressionLimit impressions were kept due to the limit, " +
753+
["Only first $IMP_LIMIT impressions were kept due to the limit, " +
753754
"all the subsequent impressions have been dropped for the auction" as String]
754755

755756
and: "PBS shouldn't emit an error"
756757
assert !response.ext?.errors
757758

758759
and: "Metrics for imps should be updated"
759760
def metrics = defaultPbsService.sendCollectedMetricsRequest()
760-
assert metrics[IMPS_DROPPED_METRIC] == bidRequest.imp.size() - impressionLimit
761-
assert metrics[IMPS_REQUESTED_METRIC] == impressionLimit
761+
assert metrics[IMPS_DROPPED_METRIC] == bidRequest.imp.size() - IMP_LIMIT
762+
assert metrics[IMPS_REQUESTED_METRIC] == IMP_LIMIT
762763

763764
and: "Response should contain seat bid"
764-
assert response.seatbid[0].bid.size() == impressionLimit
765+
assert response.seatbid[0].bid.size() == IMP_LIMIT
765766

766767
where:
767768
accountAuctionConfig << [
768-
new AccountAuctionConfig(impressionLimit: impressionLimit),
769-
new AccountAuctionConfig(impressionLimitSnakeCase: impressionLimit)
769+
new AccountAuctionConfig(impressionLimit: IMP_LIMIT),
770+
new AccountAuctionConfig(impressionLimitSnakeCase: IMP_LIMIT)
770771
]
771772
}
772773

@@ -796,8 +797,8 @@ class AuctionSpec extends BaseSpec {
796797

797798
and: "Metrics for imps requested should be updated"
798799
def metrics = defaultPbsService.sendCollectedMetricsRequest()
799-
assert metrics[IMPS_DROPPED_METRIC] == 0
800800
assert metrics[IMPS_REQUESTED_METRIC] == bidRequest.imp.size()
801+
assert !metrics[IMPS_DROPPED_METRIC]
801802

802803
and: "Response should contain seat bid"
803804
assert response.seatbid[0].bid.size() == bidRequest.imp.size()
@@ -830,8 +831,8 @@ class AuctionSpec extends BaseSpec {
830831

831832
and: "Metrics for imps requested should be updated"
832833
def metrics = defaultPbsService.sendCollectedMetricsRequest()
833-
assert metrics[IMPS_DROPPED_METRIC] == 0
834834
assert metrics[IMPS_REQUESTED_METRIC] == bidRequest.imp.size()
835+
assert !metrics[IMPS_DROPPED_METRIC]
835836

836837
and: "Response should contain seat bid"
837838
assert response.seatbid[0].bid.size() == bidRequest.imp.size()
@@ -844,7 +845,7 @@ class AuctionSpec extends BaseSpec {
844845
}
845846

846847
and: "Account in the DB with impression limit config"
847-
def accountConfig = new AccountConfig(auction: new AccountAuctionConfig(impressionLimit: impressionLimit))
848+
def accountConfig = new AccountConfig(auction: new AccountAuctionConfig(impressionLimit: IMP_LIMIT))
848849
def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig)
849850
accountDao.save(account)
850851

@@ -863,8 +864,8 @@ class AuctionSpec extends BaseSpec {
863864

864865
and: "Metrics for imps requested should be updated"
865866
def metrics = defaultPbsService.sendCollectedMetricsRequest()
866-
assert metrics[IMPS_DROPPED_METRIC] == 0
867867
assert metrics[IMPS_REQUESTED_METRIC] == bidRequest.imp.size()
868+
assert !metrics[IMPS_DROPPED_METRIC]
868869

869870
and: "Response should contain seat bid"
870871
assert response.seatbid[0].bid.size() == bidRequest.imp.size()

0 commit comments

Comments
 (0)