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

Price Floors Test Fix #3369

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Changes from all commits
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
29 changes: 6 additions & 23 deletions src/test/java/org/prebid/server/it/PriceFloorsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
import org.json.JSONException;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.prebid.server.model.Endpoint;
import org.prebid.server.util.IntegrationTestsUtil;
Expand All @@ -25,22 +24,13 @@
public class PriceFloorsTest extends IntegrationTest {

private static final int APP_PORT = 8050;
private static final int WIREMOCK_PORT = 8090;

private static final String PRICE_FLOORS = "Price Floors Test";
private static final String FLOORS_FROM_REQUEST = "Floors from request";
private static final String FLOORS_FROM_PROVIDER = "Floors from provider";

private static final RequestSpecification SPEC = IntegrationTest.spec(APP_PORT);

@BeforeAll
public static void setUpJunk() throws IOException {
WIRE_MOCK_RULE.stubFor(get(urlPathEqualTo("/periodic-update"))
.willReturn(aResponse().withBody(jsonFrom("storedrequests/test-periodic-refresh.json"))));
WIRE_MOCK_RULE.stubFor(get(urlPathEqualTo("/currency-rates"))
.willReturn(aResponse().withBody(jsonFrom("currency/latest.json"))));
}

@Test
public void openrtb2AuctionShouldApplyPriceFloorsForTheGenericBidder() throws IOException, JSONException {
// given
Expand All @@ -61,11 +51,10 @@ public void openrtb2AuctionShouldApplyPriceFloorsForTheGenericBidder() throws IO
SPEC);

// then
IntegrationTestsUtil.assertJsonEquals(
assertJsonEquals(
"openrtb2/floors/floors-test-auction-response.json",
firstResponse,
singletonList("generic"),
PriceFloorsTest::replaceBidderRelatedStaticInfo);
singletonList("generic"));

// given
final StubMapping stubMapping = WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/generic-exchange"))
Expand All @@ -83,11 +72,10 @@ public void openrtb2AuctionShouldApplyPriceFloorsForTheGenericBidder() throws IO

// then
assertThat(stubMapping.getNewScenarioState()).isEqualTo(FLOORS_FROM_PROVIDER);
IntegrationTestsUtil.assertJsonEquals(
assertJsonEquals(
"openrtb2/floors/floors-test-auction-response.json",
secondResponse,
singletonList("generic"),
PriceFloorsTest::replaceBidderRelatedStaticInfo);
singletonList("generic"));
}

@Test
Expand All @@ -105,14 +93,9 @@ public void openrtb2AuctionShouldSkipPriceFloorsForTheGenericBidderWhenGenericIs
SPEC);

// then
IntegrationTestsUtil.assertJsonEquals(
assertJsonEquals(
"openrtb2/floors/floors-test-auction-response-no-signal.json",
firstResponse,
singletonList("generic"),
PriceFloorsTest::replaceBidderRelatedStaticInfo);
}

private static String replaceBidderRelatedStaticInfo(String json, String bidder) {
return IntegrationTestsUtil.replaceBidderRelatedStaticInfo(json, bidder, WIREMOCK_PORT);
singletonList("generic"));
}
}
Loading