Skip to content

Commit

Permalink
Use placeholders in test resources instead of concrete urls where pos…
Browse files Browse the repository at this point in the history
…sible (#1084)
  • Loading branch information
schernysh authored Dec 23, 2020
1 parent 830c5d4 commit a756cc1
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 34 deletions.
7 changes: 5 additions & 2 deletions src/test/java/org/prebid/server/it/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ public void ampShouldReturnTargeting() throws IOException, JSONException {
+ "&consent_string=1YNN");

// then
JSONAssert.assertEquals(jsonFrom("amp/test-amp-response.json"), response.asString(),
JSONCompareMode.NON_EXTENSIBLE);
final String expectedAuctionResponse = openrtbAuctionResponseFrom(
"amp/test-amp-response.json",
response,
asList(RUBICON, APPNEXUS));
JSONAssert.assertEquals(expectedAuctionResponse, response.asString(), JSONCompareMode.NON_EXTENSIBLE);
}

@Test
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/org/prebid/server/it/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ private static String auctionResponseFrom(String templatePath, Response response
.replaceAll("\\{\\{ cache.endpoint }}", cacheEndpoint)
.replaceAll("\\{\\{ cache.resource_url }}", cacheEndpoint + "?uuid=")
.replaceAll("\\{\\{ cache.host }}", hostAndPort)
.replaceAll("\\{\\{ cache.path }}", cachePath);
.replaceAll("\\{\\{ cache.path }}", cachePath)
.replaceAll("\\{\\{ event.url }}", "http://localhost:8080/event?");

for (final String bidder : bidders) {
result = result.replaceAll("\\{\\{ " + bidder + "\\.exchange_uri }}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"hb_bidder_rubicon": "rubicon",
"hb_size_appnexus": "300x250",
"rpfl_1001": "2_tier0100",
"hb_cache_host": "localhost:8090",
"hb_cache_path": "/cache",
"hb_cache_host_rubicon": "localhost:8090",
"hb_cache_path_rubicon": "/cache",
"hb_cache_host_appnexus": "localhost:8090",
"hb_cache_path_appnexus": "/cache",
"hb_cache_host": "{{ cache.host }}",
"hb_cache_path": "{{ cache.path }}",
"hb_cache_host_rubicon": "{{ cache.host }}",
"hb_cache_path_rubicon": "{{ cache.path }}",
"hb_cache_host_appnexus": "{{ cache.host }}",
"hb_cache_path_appnexus": "{{ cache.path }}",
"static_keyword1": "static_value1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"cache":{
"bids":{
"url":"http://localhost:8090/cache?uuid=f0ab9105-cb21-4e59-b433-70f5ad6671cb",
"url":"{{ cache.resource_url }}f0ab9105-cb21-4e59-b433-70f5ad6671cb",
"cacheId":"f0ab9105-cb21-4e59-b433-70f5ad6671cb"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
}
},
"events": {
"win": "http://localhost:8080/event?t=win&b=a121a07f-1579-4465-bc5e-5c5b02a0c421&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=a121a07f-1579-4465-bc5e-5c5b02a0c421&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=a121a07f-1579-4465-bc5e-5c5b02a0c421&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=a121a07f-1579-4465-bc5e-5c5b02a0c421&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs"
}
}
}
Expand Down Expand Up @@ -68,8 +68,8 @@
"hb_cache_path_appnexus": "{{ cache.path }}"
},
"events": {
"win": "http://localhost:8080/event?t=win&b=7706636740145184841&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=7706636740145184841&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=7706636740145184841&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=7706636740145184841&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs"
},
"cache": {
"bids": {
Expand Down Expand Up @@ -120,8 +120,8 @@
"hb_cache_path_appnexus": "{{ cache.path }}"
},
"events": {
"win": "http://localhost:8080/event?t=win&b=928185755156387460&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=928185755156387460&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=928185755156387460&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=928185755156387460&a=5001&ts=1000&bidder=appnexus&f=i&int=dmbjs"
},
"cache": {
"bids": {
Expand Down Expand Up @@ -174,8 +174,8 @@
"hb_cache_path_appnexusAlias": "{{ cache.path }}"
},
"events": {
"win": "http://localhost:8080/event?t=win&b=7706636740145184840&a=5001&ts=1000&bidder=appnexusAlias&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=7706636740145184840&a=5001&ts=1000&bidder=appnexusAlias&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=7706636740145184840&a=5001&ts=1000&bidder=appnexusAlias&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=7706636740145184840&a=5001&ts=1000&bidder=appnexusAlias&f=i&int=dmbjs"
},
"cache": {
"bids": {
Expand Down Expand Up @@ -229,8 +229,8 @@
}
},
"events": {
"win": "http://localhost:8080/event?t=win&b=f227a07f-1579-4465-bc5e-5c5b02a0c181&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=f227a07f-1579-4465-bc5e-5c5b02a0c181&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=f227a07f-1579-4465-bc5e-5c5b02a0c181&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=f227a07f-1579-4465-bc5e-5c5b02a0c181&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
}
}
}
Expand All @@ -257,8 +257,8 @@
}
},
"events": {
"win": "http://localhost:8080/event?t=win&b=f227a07f-1579-4465-bc5e-5c5b02a0c180&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=f227a07f-1579-4465-bc5e-5c5b02a0c180&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=f227a07f-1579-4465-bc5e-5c5b02a0c180&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=f227a07f-1579-4465-bc5e-5c5b02a0c180&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
}
}
}
Expand All @@ -267,7 +267,7 @@
"id": "880290288",
"impid": "impId1",
"price": 8.43,
"adm": "<Impression><![CDATA[]]></Impression><Impression><![CDATA[http://localhost:8080/event?t=imp&b=880290288&a=5001&ts=1000&bidder=rubicon&f=b&int=dmbjs]]></Impression>",
"adm": "<Impression><![CDATA[]]></Impression><Impression><![CDATA[{{ event.url }}t=imp&b=880290288&a=5001&ts=1000&bidder=rubicon&f=b&int=dmbjs]]></Impression>",
"crid": "crid1",
"w": 300,
"h": 250,
Expand All @@ -292,8 +292,8 @@
"hb_cache_path_rubicon": "{{ cache.path }}"
},
"events": {
"win": "http://localhost:8080/event?t=win&b=880290288&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=880290288&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=880290288&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=880290288&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
},
"cache": {
"vastXml": {
Expand Down Expand Up @@ -346,8 +346,8 @@
"hb_cache_path_rubicon": "{{ cache.path }}"
},
"events": {
"win": "http://localhost:8080/event?t=win&b=466223845&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "http://localhost:8080/event?t=imp&b=466223845&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
"win": "{{ event.url }}t=win&b=466223845&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs",
"imp": "{{ event.url }}t=imp&b=466223845&a=5001&ts=1000&bidder=rubicon&f=i&int=dmbjs"
},
"cache": {
"bids": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
"cache": {
"bids": {
"cacheId": "f0ab9105-cb21-4e59-b433-70f5ad6671cb",
"url": "http://localhost:8090/cache?uuid=f0ab9105-cb21-4e59-b433-70f5ad6671cb"
"url": "{{ cache.resource_url }}f0ab9105-cb21-4e59-b433-70f5ad6671cb"
}
},
"targeting": {
"hb_bidder": "smartrtb",
"hb_bidder_smartrtb": "smartrtb",
"hb_cache_host": "localhost:8090",
"hb_cache_host_smartrtb": "localhost:8090",
"hb_cache_host": "{{ cache.host }}",
"hb_cache_host_smartrtb": "{{ cache.host }}",
"hb_cache_id": "f0ab9105-cb21-4e59-b433-70f5ad6671cb",
"hb_cache_id_smartrtb": "f0ab9105-cb21-4e59-b433-70f5ad6671cb",
"hb_cache_path": "/cache",
"hb_cache_path_smartrtb": "/cache",
"hb_cache_path": "{{ cache.path }}",
"hb_cache_path_smartrtb": "{{ cache.path }}",
"hb_pb": "0.00",
"hb_pb_smartrtb": "0.00"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"cache": {
"bids": {
"url": "http://localhost:8090/cache?uuid=5b9f507f-2ae9-4111-a697-796f3174df10",
"url": "{{ cache.resource_url }}5b9f507f-2ae9-4111-a697-796f3174df10",
"cacheId": "5b9f507f-2ae9-4111-a697-796f3174df10"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"cache": {
"bids": {
"url": "http://localhost:8090/cache?uuid=029e95ca-1a14-4e45-9669-8ad8d667de50",
"url": "{{ cache.resource_url }}029e95ca-1a14-4e45-9669-8ad8d667de50",
"cacheId": "029e95ca-1a14-4e45-9669-8ad8d667de50"
}
}
Expand Down

0 comments on commit a756cc1

Please sign in to comment.