Skip to content

Commit

Permalink
Added test for configurable targeting prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
VeryExtraordinaryUsername committed Nov 17, 2023
1 parent 56cb015 commit a418ef6
Showing 1 changed file with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.prebid.server.proto.openrtb.ext.request.ExtGranularityRange;
import org.prebid.server.proto.openrtb.ext.request.ExtPriceGranularity;
import org.prebid.server.settings.model.Account;
import org.prebid.server.settings.model.AccountAuctionConfig;
import org.prebid.server.settings.model.AccountTargetingConfig;

import java.math.BigDecimal;
import java.util.Map;
Expand Down Expand Up @@ -549,6 +551,36 @@ public void shouldNotIncludeDealBidTargetingIfAlwaysIncludeDealsFlagIsFalse() {

@Test
public void shouldReturnTargetingKeywordsWithCustomPrefixForOrdinaryBidOpenrtb() {
//TODO:
// given
String expected = "test_";
AccountTargetingConfig targetingConfig = AccountTargetingConfig.builder().targetingPrefix(expected).build();
AccountAuctionConfig auctionConfig = AccountAuctionConfig.builder().targeting(targetingConfig).build();
Account account = Account.builder().auction(auctionConfig).build();
final Bid bid = Bid.builder().price(BigDecimal.ONE)
.dealid("dealId1").w(50).h(100).build();

// when
final Map<String, String> keywords = TargetingKeywordsCreator.create(
ExtPriceGranularity.of(
2,
singletonList(ExtGranularityRange.of(BigDecimal.valueOf(5), BigDecimal.valueOf(0.5)))),
true,
true,
false,
false,
false,
0,
null,
null,
null,
account)
.makeFor(bid, "bidder1", false, null, null, null, null);

// then
assertThat(keywords).containsOnly(
entry(expected + "pb_bidder1", "1.00"),
entry(expected + "bidder_bidder1", "bidder1"),
entry(expected + "size_bidder1", "50x100"),
entry(expected + "deal_bidder1", "dealId1"));
}
}

0 comments on commit a418ef6

Please sign in to comment.