Skip to content

Commit 4ee05b4

Browse files
add tests for showheroes alias
1 parent d21324c commit 4ee05b4

6 files changed

Lines changed: 194 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.prebid.server.it;
2+
3+
import io.restassured.response.Response;
4+
import org.json.JSONException;
5+
import org.junit.jupiter.api.Test;
6+
import org.prebid.server.model.Endpoint;
7+
import org.prebid.server.version.PrebidVersionProvider;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
10+
import java.io.IOException;
11+
12+
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
13+
import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
14+
import static com.github.tomakehurst.wiremock.client.WireMock.post;
15+
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
16+
import static java.util.Collections.singletonList;
17+
18+
public class ShowheroesBSTest extends IntegrationTest {
19+
20+
@Autowired
21+
private PrebidVersionProvider prebidVersionProvider;
22+
23+
@Test
24+
public void openrtb2AuctionShouldRespondWithBidsFromShowheroesBS() throws IOException, JSONException {
25+
// given
26+
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/showheroesbs-exchange"))
27+
.withRequestBody(equalToJson(jsonFrom("openrtb2/showheroesBs/test-showheroes-bid-request.json",
28+
prebidVersionProvider)))
29+
.willReturn(
30+
aResponse().withBody(jsonFrom("openrtb2/showheroesBs/test-showheroes-bid-response.json"))));
31+
32+
// when
33+
final Response response = responseFor("openrtb2/showheroesBs/test-auction-showheroes-request.json",
34+
Endpoint.openrtb2_auction);
35+
36+
// then
37+
assertJsonEquals("openrtb2/showheroesBs/test-auction-showheroes-response.json", response,
38+
singletonList("showheroesBs"));
39+
}
40+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"id": "request_id",
3+
"imp": [
4+
{
5+
"id": "imp_id",
6+
"banner": {
7+
"w": 320,
8+
"h": 250
9+
},
10+
"ext": {
11+
"showheroesBs": {
12+
"unitId": "12345"
13+
}
14+
},
15+
"tagid": "tag_id"
16+
}
17+
],
18+
"tmax": 5000,
19+
"regs": {
20+
"ext": {
21+
"gdpr": 0
22+
}
23+
}
24+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"id": "request_id",
3+
"seatbid": [
4+
{
5+
"bid": [
6+
{
7+
"id": "bid_id",
8+
"impid": "imp_id",
9+
"exp": 300,
10+
"price": 0.01,
11+
"adid": "adid",
12+
"cid": "cid",
13+
"crid": "crid",
14+
"mtype": 1,
15+
"ext": {
16+
"prebid": {
17+
"type": "banner",
18+
"meta": {
19+
"adaptercode": "showheroesBs"
20+
}
21+
},
22+
"origbidcpm": 0.01,
23+
"origbidcur": "USD"
24+
}
25+
}
26+
],
27+
"seat": "showheroesBs",
28+
"group": 0
29+
}
30+
],
31+
"cur": "USD",
32+
"ext": {
33+
"responsetimemillis": {
34+
"showheroesBs": "{{ showheroesBs.response_time_ms }}"
35+
},
36+
"prebid": {
37+
"auctiontimestamp": 0
38+
},
39+
"tmaxrequest": 5000
40+
}
41+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"id": "request_id",
3+
"imp": [
4+
{
5+
"id": "imp_id",
6+
"secure": 1,
7+
"banner": {
8+
"w": 320,
9+
"h": 250
10+
},
11+
"tagid": "tag_id",
12+
"ext": {
13+
"tid": "${json-unit.any-string}",
14+
"bidder": {
15+
"unitId": "12345"
16+
},
17+
"params": {
18+
"unitId": "12345"
19+
}
20+
}
21+
}
22+
],
23+
"site": {
24+
"domain": "www.example.com",
25+
"page": "http://www.example.com",
26+
"publisher": {
27+
"domain": "example.com"
28+
},
29+
"ext": {
30+
"amp": 0
31+
}
32+
},
33+
"device": {
34+
"ua": "userAgent",
35+
"ip": "193.168.244.1"
36+
},
37+
"at": 1,
38+
"tmax": "${json-unit.any-number}",
39+
"cur": ["USD"],
40+
"source": {
41+
"tid": "${json-unit.any-string}",
42+
"ext": {
43+
"pbs": {
44+
"pbsv": "{{ pbs.java.version }}",
45+
"pbsp": "java"
46+
}
47+
}
48+
},
49+
"regs": {
50+
"gdpr": 0
51+
},
52+
"ext": {
53+
"prebid": {
54+
"server": {
55+
"externalurl": "http://localhost:8080",
56+
"gvlid": 1,
57+
"datacenter": "local",
58+
"endpoint": "/openrtb2/auction"
59+
}
60+
}
61+
}
62+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"id": "request_id",
3+
"seatbid": [
4+
{
5+
"bid": [
6+
{
7+
"crid": "crid",
8+
"adid": "adid",
9+
"price": 0.01,
10+
"id": "bid_id",
11+
"impid": "imp_id",
12+
"cid": "cid",
13+
"mtype": 1,
14+
"ext": {
15+
"prebid": {
16+
"type": "banner"
17+
}
18+
}
19+
}
20+
],
21+
"type": "banner"
22+
}
23+
],
24+
"cur": "USD"
25+
}

src/test/resources/org/prebid/server/it/test-application.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ adapters.sharethrough.enabled=true
541541
adapters.sharethrough.endpoint=http://localhost:8090/sharethrough-exchange
542542
adapters.showheroes.enabled=true
543543
adapters.showheroes.endpoint=http://localhost:8090/showheroes-exchange
544+
adapters.showheroes.aliases.showheroesBs.enabled=true
545+
adapters.showheroes.aliases.showheroesBs.endpoint=http://localhost:8090/showheroesbs-exchange
544546
adapters.silvermob.enabled=true
545547
adapters.silvermob.endpoint=http://localhost:8090/silvermob-exchange
546548
adapters.silverpush.enabled=true

0 commit comments

Comments
 (0)