Skip to content

Commit 5a880fb

Browse files
committed
Tests: Support GET interface profiles
1 parent 0495b1e commit 5a880fb

6 files changed

Lines changed: 918 additions & 20 deletions

File tree

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
package org.prebid.server.functional.model.request.get
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty
4+
import org.prebid.server.functional.model.request.amp.ConsentType
5+
import org.prebid.server.functional.model.request.auction.DebugCondition
6+
import org.prebid.server.functional.util.PBSUtils
7+
8+
import static org.prebid.server.functional.model.request.auction.DebugCondition.ENABLED
9+
10+
class GeneralGetRequest {
11+
12+
@JsonProperty("srid")
13+
String storedRequestId
14+
15+
@JsonProperty("tag_id")
16+
String storedRequestIdLegacy
17+
18+
@JsonProperty("pubid")
19+
String accountId
20+
21+
@JsonProperty("account")
22+
String accountIdLegacy
23+
24+
@JsonProperty("tmax")
25+
Integer timeoutMax
26+
27+
@JsonProperty("debug")
28+
DebugCondition debug
29+
30+
@JsonProperty("of")
31+
String outputFormat
32+
33+
@JsonProperty("om")
34+
String outputModule
35+
36+
@JsonProperty("rprof")
37+
List<String> requestProfiles
38+
39+
@JsonProperty("iprof")
40+
List<String> impProfiles
41+
42+
@JsonProperty("sarid")
43+
String storedAuctionResponseId
44+
45+
@JsonProperty("mimes")
46+
List<String> mimes
47+
48+
@JsonProperty("w")
49+
Integer width
50+
51+
@JsonProperty("h")
52+
Integer height
53+
54+
@JsonProperty("ow")
55+
Integer originalWidth
56+
57+
@JsonProperty("oh")
58+
Integer originalHeight
59+
60+
@JsonProperty("sizes")
61+
Object sizes
62+
63+
@JsonProperty("ms")
64+
Object sizesLegacy
65+
66+
@JsonProperty("slot")
67+
String slot
68+
69+
@JsonProperty("mindur")
70+
Integer minDuration
71+
72+
@JsonProperty("maxdur")
73+
Integer maxDuration
74+
75+
@JsonProperty("api")
76+
List<Integer> api
77+
78+
@JsonProperty("battr")
79+
List<Integer> battr
80+
81+
@JsonProperty("delivery")
82+
List<Integer> delivery
83+
84+
@JsonProperty("linearity")
85+
Integer linearityMode
86+
87+
@JsonProperty("minbr")
88+
Integer minBitrate
89+
90+
@JsonProperty("maxbr")
91+
Integer maxBitrate
92+
93+
@JsonProperty("maxex")
94+
Integer maxExtended
95+
96+
@JsonProperty("maxseq")
97+
Integer maxSequence
98+
99+
@JsonProperty("mincpms")
100+
Integer minCpmPerSec
101+
102+
@JsonProperty("poddur")
103+
Integer podDuration
104+
105+
@JsonProperty("podid")
106+
Integer podId
107+
108+
@JsonProperty("podseq")
109+
Integer podSequence
110+
111+
@JsonProperty("proto")
112+
List<Integer> proto
113+
114+
@JsonProperty("rqddurs")
115+
List<Integer> requiredDurations
116+
117+
@JsonProperty("seq")
118+
Integer sequence
119+
120+
@JsonProperty("slotinpod")
121+
Integer slotInPod
122+
123+
@JsonProperty("startdelay")
124+
Integer startDelay
125+
126+
@JsonProperty("skip")
127+
Integer skip
128+
129+
@JsonProperty("skipafter")
130+
Integer skipAfter
131+
132+
@JsonProperty("skipmin")
133+
Integer skipMin
134+
135+
@JsonProperty("pos")
136+
Integer position
137+
138+
@JsonProperty("stitched")
139+
Integer stitched
140+
141+
@JsonProperty("feed")
142+
Integer feed
143+
144+
@JsonProperty("nvol")
145+
Integer normalizedVolume
146+
147+
@JsonProperty("placement")
148+
Integer placement
149+
150+
@JsonProperty("plcmt")
151+
Integer placementSubtype
152+
153+
@JsonProperty("playbackend")
154+
Integer playbackEndMode
155+
156+
@JsonProperty("playbackmethod")
157+
List<Integer> playbackMethods
158+
159+
@JsonProperty("boxingallowed")
160+
Integer boxingAllowed
161+
162+
@JsonProperty("btype")
163+
List<Integer> bannerTypes
164+
165+
@JsonProperty("expdir")
166+
List<Integer> expandableDirections
167+
168+
@JsonProperty("topframe")
169+
Integer topFrame
170+
171+
@JsonProperty("targeting")
172+
String targeting
173+
174+
@JsonProperty("consent")
175+
String gppConsent
176+
177+
@JsonProperty("gdpr_consent")
178+
String gppConsentLegacy
179+
180+
@JsonProperty("consent_string")
181+
String gppConsentStringLegacy
182+
183+
@JsonProperty("gdpr")
184+
Integer gdpr
185+
186+
@JsonProperty("privacy")
187+
Integer privacy
188+
189+
@JsonProperty("gdpr_applies")
190+
String gdprApplies
191+
192+
@JsonProperty("usp")
193+
String usPrivacy
194+
195+
@JsonProperty("addtl_consent")
196+
String additionalConsent
197+
198+
@JsonProperty("consent_type")
199+
ConsentType consentType
200+
201+
@JsonProperty("gpp_sid")
202+
Integer gppSid
203+
204+
@JsonProperty("coppa")
205+
Integer coppaFlag
206+
207+
@JsonProperty("gpc")
208+
Integer globalPrivacyControl
209+
210+
@JsonProperty("dnt")
211+
Integer doNotTrack
212+
213+
@JsonProperty("lmt")
214+
Integer limitAdTracking
215+
216+
@JsonProperty("bcat")
217+
List<String> blockedCategories
218+
219+
@JsonProperty("badv")
220+
List<String> blockedAdvertisers
221+
222+
@JsonProperty("page")
223+
String page
224+
225+
@JsonProperty("bundle")
226+
String appBundle
227+
228+
@JsonProperty("name")
229+
String appName
230+
231+
@JsonProperty("storeurl")
232+
String storeUrl
233+
234+
@JsonProperty("cgenre")
235+
String contentGenre
236+
237+
@JsonProperty("clang")
238+
String contentLanguage
239+
240+
@JsonProperty("crating")
241+
String contentRating
242+
243+
@JsonProperty("ccat")
244+
Integer contentCategory
245+
246+
@JsonProperty("ccattax")
247+
List<String> contentCategoryTaxonomy
248+
249+
@JsonProperty("cseries")
250+
String contentSeries
251+
252+
@JsonProperty("rss_feed")
253+
String contentSeriesAlias
254+
255+
@JsonProperty("ctitle")
256+
String contentTitle
257+
258+
@JsonProperty("curl")
259+
String contentUrl
260+
261+
@JsonProperty("clivestream")
262+
String contentLivestream
263+
264+
@JsonProperty("ip")
265+
String deviceIp
266+
267+
@JsonProperty("ua")
268+
String deviceUa
269+
270+
@JsonProperty("dtype")
271+
String deviceType
272+
273+
@JsonProperty("ifa")
274+
String deviceIfa
275+
276+
@JsonProperty("ifat")
277+
String deviceIfaType
278+
279+
@JsonProperty("unknown")
280+
String unknown
281+
282+
@JsonProperty("unknown_alias")
283+
String unknownAlias
284+
285+
static GeneralGetRequest getDefault(String storedRequestId = PBSUtils.randomNumber) {
286+
new GeneralGetRequest(storedRequestId: storedRequestId, debug: ENABLED)
287+
}
288+
289+
String resolveStoredRequestId() {
290+
storedRequestId != null ? storedRequestId : storedRequestIdLegacy
291+
}
292+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.prebid.server.functional.model.response.get
2+
3+
import groovy.transform.ToString
4+
import org.prebid.server.functional.model.response.amp.AmpResponseExt
5+
6+
@ToString(includeNames = true, ignoreNulls = true)
7+
class GeneralGetResponse {
8+
9+
Map<String, String> targeting
10+
GeneralGetResponseExt ext
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.prebid.server.functional.model.response.get
2+
3+
import groovy.transform.ToString
4+
import org.prebid.server.functional.model.response.BidderError
5+
import org.prebid.server.functional.model.response.Debug
6+
import org.prebid.server.functional.model.response.auction.ErrorType
7+
8+
@ToString(includeNames = true, ignoreNulls = true)
9+
class GeneralGetResponseExt {
10+
11+
Debug debug
12+
Map<ErrorType, List<BidderError>> errors
13+
Map<ErrorType, List<BidderError>> warnings
14+
}

src/test/groovy/org/prebid/server/functional/service/PrebidServerService.groovy

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import org.prebid.server.functional.model.request.amp.AmpRequest
1313
import org.prebid.server.functional.model.request.auction.BidRequest
1414
import org.prebid.server.functional.model.request.cookiesync.CookieSyncRequest
1515
import org.prebid.server.functional.model.request.event.EventRequest
16+
import org.prebid.server.functional.model.request.get.GeneralGetRequest
1617
import org.prebid.server.functional.model.request.logging.httpinteraction.HttpInteractionRequest
1718
import org.prebid.server.functional.model.request.setuid.SetuidRequest
1819
import org.prebid.server.functional.model.request.vtrack.VtrackRequest
@@ -24,6 +25,7 @@ import org.prebid.server.functional.model.response.biddersparams.BiddersParamsRe
2425
import org.prebid.server.functional.model.response.cookiesync.CookieSyncResponse
2526
import org.prebid.server.functional.model.response.cookiesync.RawCookieSyncResponse
2627
import org.prebid.server.functional.model.response.currencyrates.CurrencyRatesResponse
28+
import org.prebid.server.functional.model.response.get.GeneralGetResponse
2729
import org.prebid.server.functional.model.response.getuids.GetuidResponse
2830
import org.prebid.server.functional.model.response.infobidders.BidderInfoResponse
2931
import org.prebid.server.functional.model.response.setuid.SetuidResponse
@@ -45,6 +47,7 @@ import static java.time.ZoneOffset.UTC
4547
class PrebidServerService implements ObjectMapperWrapper {
4648

4749
static final String AUCTION_ENDPOINT = "/openrtb2/auction"
50+
static final String GENERAL_GET_ENDPOINT = "/openrtb2/auction"
4851
static final String AMP_ENDPOINT = "/openrtb2/amp"
4952
static final String COOKIE_SYNC_ENDPOINT = "/cookie_sync"
5053
static final String SET_UID_ENDPOINT = "/setuid"
@@ -94,11 +97,11 @@ class PrebidServerService implements ObjectMapperWrapper {
9497
}
9598
}
9699

97-
AmpResponse sendAmpRequestWithAdditionalQueries(AmpRequest ampRequest, Map<String, Object> queries = [:]) {
98-
def response = getAmp(ampRequest, [:], queries)
100+
GeneralGetResponse sendGeneralGetRequest(GeneralGetRequest request, Map<String, String> headers = [:]) {
101+
def response = getAuction(request, headers)
99102

100103
checkResponseStatusCode(response)
101-
decode(response.body.asString(), AmpResponse)
104+
decode(response.body.asString(), GeneralGetResponse)
102105
}
103106

104107
AmpResponse sendAmpRequest(AmpRequest ampRequest, Map<String, String> headers = [:]) {
@@ -331,20 +334,22 @@ class PrebidServerService implements ObjectMapperWrapper {
331334
requestSpecification.post(COOKIE_SYNC_ENDPOINT)
332335
}
333336

334-
private Response getAmp(AmpRequest ampRequest,
335-
Map<String, String> headers = [:],
336-
Map<String, Object> queries = [:]) {
337+
private Response getAmp(AmpRequest ampRequest, Map<String, String> headers = [:]) {
337338
def map = toMap(ampRequest)
338339

339-
if (!queries.isEmpty()) {
340-
map.putAll(queries)
341-
}
342-
343340
given(requestSpecification).headers(headers)
344341
.queryParams(map)
345342
.get(AMP_ENDPOINT)
346343
}
347344

345+
private Response getAuction(GeneralGetRequest request, Map<String, String> headers = [:]) {
346+
def map = toMap(request)
347+
348+
given(requestSpecification).headers(headers)
349+
.queryParams(map)
350+
.get(GENERAL_GET_ENDPOINT)
351+
}
352+
348353
private void checkResponseStatusCode(Response response, int statusCode = 200) {
349354
def responseStatusCode = response.statusCode
350355
if (responseStatusCode != statusCode) {

0 commit comments

Comments
 (0)