From ea7c95ab82b73eb653c14d1d980a082ee20f4fe2 Mon Sep 17 00:00:00 2001 From: Viacheslav Chimishuk Date: Wed, 14 Oct 2020 20:51:08 +0300 Subject: [PATCH] Addressed code review comments. --- adapters/adoppler/adoppler.go | 14 +- .../adopplertest/exemplary/custom-client.json | 67 +++++-- .../exemplary/default-client.json | 63 ++++-- .../adopplertest/exemplary/multibid.json | 118 +++++------ .../adopplertest/exemplary/no-bid.json | 63 ++++-- .../supplemental/bad-request.json | 71 +++++-- .../supplemental/duplicate-imp.json | 166 ++++++++++++---- .../supplemental/invalid-impid.json | 91 +++++++-- .../supplemental/invalid-response.json | 71 +++++-- .../supplemental/invalid-video-ext.json | 188 ++++++++++++++---- .../supplemental/missing-adunit.json | 40 +++- .../supplemental/server-error.json | 71 +++++-- 12 files changed, 756 insertions(+), 267 deletions(-) diff --git a/adapters/adoppler/adoppler.go b/adapters/adoppler/adoppler.go index 84a86d5cedf..738219f3abd 100644 --- a/adapters/adoppler/adoppler.go +++ b/adapters/adoppler/adoppler.go @@ -8,6 +8,7 @@ import ( "net/url" "text/template" + "github.com/golang/glog" "github.com/mxmCherry/openrtb" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/errortypes" @@ -37,8 +38,13 @@ type AdopplerAdapter struct { func NewAdopplerBidder(endpoint string) *AdopplerAdapter { e := endpoint + "/processHeaderBid/{{.AdUnit}}" + t, err := template.New("endpoint").Parse(e) + if err != nil { + glog.Fatalf("Unable to parse endpoint url template: %s", err) + return nil + } - return &AdopplerAdapter{template.Must(template.New("endpoint").Parse(e))} + return &AdopplerAdapter{t} } func (ads *AdopplerAdapter) MakeRequests( @@ -73,7 +79,9 @@ func (ads *AdopplerAdapter) MakeRequests( uri, err := ads.bidUri(ext) if err != nil { - errs = append(errs, &errortypes.BadInput{err.Error()}) + e := fmt.Sprintf("Unable to build bid URI: %s", + err.Error()) + errs = append(errs, &errortypes.BadInput{e}) continue } data := &adapters.RequestData{ @@ -187,7 +195,7 @@ func (ads *AdopplerAdapter) bidUri(ext *openrtb_ext.ExtImpAdoppler) (string, err if ext.Client == "" { params.AccountID = DefaultClient } else { - params.AccountID = ext.Client + params.AccountID = url.PathEscape(ext.Client) } return macros.ResolveMacros(*ads.endpoint, params) diff --git a/adapters/adoppler/adopplertest/exemplary/custom-client.json b/adapters/adoppler/adopplertest/exemplary/custom-client.json index 74ce7f88ed0..0dc47acf2cd 100644 --- a/adapters/adoppler/adopplertest/exemplary/custom-client.json +++ b/adapters/adoppler/adopplertest/exemplary/custom-client.json @@ -1,15 +1,52 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1", - "client": "client1"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://client1.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1", - "client": "client1"}}}]}}, - "mockResponse": {"status": 204, - "body": ""}}], - "expectedBidResponses": []} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1", + "client":"client1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://client1.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1", + "client":"client1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":204, + "body":"" + } + } + ], + "expectedBidResponses":[ + + ] +} diff --git a/adapters/adoppler/adopplertest/exemplary/default-client.json b/adapters/adoppler/adopplertest/exemplary/default-client.json index cf8a1178b9e..08a29481350 100644 --- a/adapters/adoppler/adopplertest/exemplary/default-client.json +++ b/adapters/adoppler/adopplertest/exemplary/default-client.json @@ -1,13 +1,50 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 204, - "body": ""}}], - "expectedBidResponses": []} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":204, + "body":"" + } + } + ], + "expectedBidResponses":[ + + ] +} diff --git a/adapters/adoppler/adopplertest/exemplary/multibid.json b/adapters/adoppler/adopplertest/exemplary/multibid.json index 8553b5f9df4..08a29481350 100644 --- a/adapters/adoppler/adopplertest/exemplary/multibid.json +++ b/adapters/adoppler/adopplertest/exemplary/multibid.json @@ -1,68 +1,50 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}, - {"id": "imp2", - "video": {"minduration": 120, - "mimes": ["video/mp4"]}, - "ext": {"bidder": {"adunit": "unit2"}}}, - {"id": "imp3", - "native": {"request": "{}"}, - "ext": {"bidder": {"adunit": "unit3"}}}], - "source": {"ext": {"schain": {"ver": "1.0"}}}, - "regs": {"ext": {"us_privacy": "1YNY"}}}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}], - "source": {"ext": {"schain": {"ver": "1.0"}}}, - "regs": {"ext": {"us_privacy": "1YNY"}}}}, - "mockResponse": {"status": 200, - "body": {"id": "req1-imp1-resp1", - "seatbid": [{"bid": [{"id": "req1-imp1-bid1", - "impid": "imp1", - "price": 0.12, - "adm": "a banner"}]}], - "cur": "USD"}}}, - {"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit2", - "body": {"id": "req1-unit2", - "imp": [{"id": "imp2", - "video": {"minduration": 120, - "mimes": ["video/mp4"]}, - "ext": {"bidder": {"adunit": "unit2"}}}], - "source": {"ext": {"schain": {"ver": "1.0"}}}, - "regs": {"ext": {"us_privacy": "1YNY"}}}}, - "mockResponse": {"status": 200, - "body": {"id": "req1-imp2-resp2", - "seatbid": [{"bid": [{"id": "req1-imp2-bid1", - "impid": "imp2", - "price": 0.24, - "adm": "", - "cat": ["IAB1", "IAB2"], - "ext": {"ads": {"video": {"duration": 121}}}}]}], - "cur": "USD"}}}, - {"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit3", - "body": {"id": "req1-unit3", - "imp": [{"id": "imp3", - "native": {"request": "{}"}, - "ext": {"bidder": {"adunit": "unit3"}}}], - "source": {"ext": {"schain": {"ver": "1.0"}}}, - "regs": {"ext": {"us_privacy": "1YNY"}}}}, - "mockResponse": {"status": 204, - "body": ""}}], - "expectedBidResponses": [{"currency": "USD", - "bids": [{"bid": {"id": "req1-imp1-bid1", - "impid": "imp1", - "price": 0.12, - "adm": "a banner"}, - "type": "banner"}]}, - {"currency": "USD", - "bids": [{"bid": {"id": "req1-imp2-bid1", - "impid": "imp2", - "price": 0.24, - "adm": "", - "cat": ["IAB1", "IAB2"], - "ext": {"ads": {"video": {"duration": 121}}}}, - "type": "video"}]}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":204, + "body":"" + } + } + ], + "expectedBidResponses":[ + + ] +} diff --git a/adapters/adoppler/adopplertest/exemplary/no-bid.json b/adapters/adoppler/adopplertest/exemplary/no-bid.json index cf8a1178b9e..08a29481350 100644 --- a/adapters/adoppler/adopplertest/exemplary/no-bid.json +++ b/adapters/adoppler/adopplertest/exemplary/no-bid.json @@ -1,13 +1,50 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 204, - "body": ""}}], - "expectedBidResponses": []} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":204, + "body":"" + } + } + ], + "expectedBidResponses":[ + + ] +} diff --git a/adapters/adoppler/adopplertest/supplemental/bad-request.json b/adapters/adoppler/adopplertest/supplemental/bad-request.json index c51f8ad382e..ae515e01e18 100644 --- a/adapters/adoppler/adopplertest/supplemental/bad-request.json +++ b/adapters/adoppler/adopplertest/supplemental/bad-request.json @@ -1,15 +1,56 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 400, - "body": ""}}], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [{"value": "bad request", - "comparison": "literal"}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":400, + "body":"" + } + } + ], + "expectedBidResponses":[ + + ], + "expectedMakeBidsErrors":[ + { + "value":"bad request", + "comparison":"literal" + } + ] +} diff --git a/adapters/adoppler/adopplertest/supplemental/duplicate-imp.json b/adapters/adoppler/adopplertest/supplemental/duplicate-imp.json index 6acbc682283..d6f17a6bb2c 100644 --- a/adapters/adoppler/adopplertest/supplemental/duplicate-imp.json +++ b/adapters/adoppler/adopplertest/supplemental/duplicate-imp.json @@ -1,38 +1,128 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}, - {"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit2"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 200, - "body": {"id": "req1-imp1-resp1", - "seatbid": [{"bid": [{"id": "req1-imp1-bid1", - "impid": "imp1", - "price": 0.12, - "adm": "a banner"}]}], - "cur": "USD"}}}, - {"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit2", - "body": {"id": "req1-unit2", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit2"}}}]}}, - "mockResponse": {"status": 200, - "body": {"id": "req1-imp1-resp1", - "seatbid": [{"bid": [{"id": "req1-imp1-bid1", - "impid": "imp1", - "price": 0.12, - "adm": "a banner"}]}], - "cur": "USD"}}}], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [{"value": "duplicate $.imp.id imp1", - "comparison": "literal"}, - {"value": "duplicate $.imp.id imp1", - "comparison": "literal"}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + }, + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit2" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":200, + "body":{ + "id":"req1-imp1-resp1", + "seatbid":[ + { + "bid":[ + { + "id":"req1-imp1-bid1", + "impid":"imp1", + "price":0.12, + "adm":"a banner" + } + ] + } + ], + "cur":"USD" + } + } + }, + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit2", + "body":{ + "id":"req1-unit2", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit2" + } + } + } + ] + } + }, + "mockResponse":{ + "status":200, + "body":{ + "id":"req1-imp1-resp1", + "seatbid":[ + { + "bid":[ + { + "id":"req1-imp1-bid1", + "impid":"imp1", + "price":0.12, + "adm":"a banner" + } + ] + } + ], + "cur":"USD" + } + } + } + ], + "expectedBidResponses":[ + + ], + "expectedMakeBidsErrors":[ + { + "value":"duplicate $.imp.id imp1", + "comparison":"literal" + }, + { + "value":"duplicate $.imp.id imp1", + "comparison":"literal" + } + ] +} diff --git a/adapters/adoppler/adopplertest/supplemental/invalid-impid.json b/adapters/adoppler/adopplertest/supplemental/invalid-impid.json index c5da9b201ba..b5f062ac94a 100644 --- a/adapters/adoppler/adopplertest/supplemental/invalid-impid.json +++ b/adapters/adoppler/adopplertest/supplemental/invalid-impid.json @@ -1,20 +1,71 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 200, - "body": {"id": "req1-imp1-resp1", - "seatbid": [{"bid": [{"id": "req1-imp1-bid1", - "impid": "invalid", - "price": 0.12, - "adm": "a banner"}]}], - "cur": "USD"}}}], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [{"value": "unknown impid: invalid", - "comparison": "literal"}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":200, + "body":{ + "id":"req1-imp1-resp1", + "seatbid":[ + { + "bid":[ + { + "id":"req1-imp1-bid1", + "impid":"invalid", + "price":0.12, + "adm":"a banner" + } + ] + } + ], + "cur":"USD" + } + } + } + ], + "expectedBidResponses":[ + + ], + "expectedMakeBidsErrors":[ + { + "value":"unknown impid: invalid", + "comparison":"literal" + } + ] +} diff --git a/adapters/adoppler/adopplertest/supplemental/invalid-response.json b/adapters/adoppler/adopplertest/supplemental/invalid-response.json index 790cb73f9ae..d0a7d2ef84b 100644 --- a/adapters/adoppler/adopplertest/supplemental/invalid-response.json +++ b/adapters/adoppler/adopplertest/supplemental/invalid-response.json @@ -1,15 +1,56 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 200, - "body": "invalid-json"}}], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [{"value": "invalid body: json: cannot unmarshal string into Go value of type openrtb.BidResponse", - "comparison": "literal"}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":200, + "body":"invalid-json" + } + } + ], + "expectedBidResponses":[ + + ], + "expectedMakeBidsErrors":[ + { + "value":"invalid body: json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "comparison":"literal" + } + ] +} diff --git a/adapters/adoppler/adopplertest/supplemental/invalid-video-ext.json b/adapters/adoppler/adopplertest/supplemental/invalid-video-ext.json index b2d893cc587..c08cdca5cee 100644 --- a/adapters/adoppler/adopplertest/supplemental/invalid-video-ext.json +++ b/adapters/adoppler/adopplertest/supplemental/invalid-video-ext.json @@ -1,43 +1,145 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "video": {"minduration": 120, - "mimes": ["video/mp4"]}, - "ext": {"bidder": {"adunit": "unit1"}}}, - {"id": "imp2", - "video": {"minduration": 120, - "mimes": ["video/mp4"]}, - "ext": {"bidder": {"adunit": "unit2"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "video": {"minduration": 120, - "mimes": ["video/mp4"]}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 200, - "body": {"id": "req1-imp1-resp1", - "seatbid": [{"bid": [{"id": "req1-imp1-bid1", - "impid": "imp1", - "price": 0.24, - "adm": "", - "cat": ["IAB1", "IAB2"], - "ext": {}}]}], - "cur": "USD"}}}, - {"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit2", - "body": {"id": "req1-unit2", - "imp": [{"id": "imp2", - "video": {"minduration": 120, - "mimes": ["video/mp4"]}, - "ext": {"bidder": {"adunit": "unit2"}}}]}}, - "mockResponse": {"status": 200, - "body": {"id": "req1-imp2-resp2", - "seatbid": [{"bid": [{"id": "req1-imp2-bid2", - "impid": "imp2", - "price": 0.24, - "adm": "", - "cat": ["IAB1", "IAB2"], - "ext": ""}]}], - "cur": "USD"}}}], - "expectedMakeBidsErrors": [{"value": "$.seatbid.bid.ext.ads.video required", - "comparison": "literal"}, - {"value": "json: cannot unmarshal string into Go value of type struct { Ads *adoppler.adsImpExt \"json:\\\"ads\\\"\" }", - "comparison": "literal"}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "video":{ + "minduration":120, + "mimes":[ + "video/mp4" + ] + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + }, + { + "id":"imp2", + "video":{ + "minduration":120, + "mimes":[ + "video/mp4" + ] + }, + "ext":{ + "bidder":{ + "adunit":"unit2" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "video":{ + "minduration":120, + "mimes":[ + "video/mp4" + ] + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":200, + "body":{ + "id":"req1-imp1-resp1", + "seatbid":[ + { + "bid":[ + { + "id":"req1-imp1-bid1", + "impid":"imp1", + "price":0.24, + "adm":"", + "cat":[ + "IAB1", + "IAB2" + ], + "ext":{ + + } + } + ] + } + ], + "cur":"USD" + } + } + }, + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit2", + "body":{ + "id":"req1-unit2", + "imp":[ + { + "id":"imp2", + "video":{ + "minduration":120, + "mimes":[ + "video/mp4" + ] + }, + "ext":{ + "bidder":{ + "adunit":"unit2" + } + } + } + ] + } + }, + "mockResponse":{ + "status":200, + "body":{ + "id":"req1-imp2-resp2", + "seatbid":[ + { + "bid":[ + { + "id":"req1-imp2-bid2", + "impid":"imp2", + "price":0.24, + "adm":"", + "cat":[ + "IAB1", + "IAB2" + ], + "ext":"" + } + ] + } + ], + "cur":"USD" + } + } + } + ], + "expectedMakeBidsErrors":[ + { + "value":"$.seatbid.bid.ext.ads.video required", + "comparison":"literal" + }, + { + "value":"json: cannot unmarshal string into Go value of type struct { Ads *adoppler.adsImpExt \"json:\\\"ads\\\"\" }", + "comparison":"literal" + } + ] +} diff --git a/adapters/adoppler/adopplertest/supplemental/missing-adunit.json b/adapters/adoppler/adopplertest/supplemental/missing-adunit.json index 82a6a95ed58..df9bbe5771d 100644 --- a/adapters/adoppler/adopplertest/supplemental/missing-adunit.json +++ b/adapters/adoppler/adopplertest/supplemental/missing-adunit.json @@ -1,9 +1,31 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {}}}]}, - "httpCalls": [], - "expectedBidResponses": [], - "expectedMakeRequestsErrors": [{"value": "$.imp.ext.adoppler.adunit required", - "comparison": "literal"}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + + } + } + } + ] + }, + "httpCalls":[ + + ], + "expectedBidResponses":[ + + ], + "expectedMakeRequestsErrors":[ + { + "value":"$.imp.ext.adoppler.adunit required", + "comparison":"literal" + } + ] +} diff --git a/adapters/adoppler/adopplertest/supplemental/server-error.json b/adapters/adoppler/adopplertest/supplemental/server-error.json index 597049f41e1..604b83e74a6 100644 --- a/adapters/adoppler/adopplertest/supplemental/server-error.json +++ b/adapters/adoppler/adopplertest/supplemental/server-error.json @@ -1,15 +1,56 @@ -{"mockBidRequest": {"id": "req1", - "imp":[{"id": "imp1", - "banner": {"w": 100, - "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}, - "httpCalls": [{"expectedRequest": {"uri": "http://app.trustedmarketplace.com/processHeaderBid/unit1", - "body": {"id": "req1-unit1", - "imp": [{"id": "imp1", - "banner": {"w": 100, "h": 200}, - "ext": {"bidder": {"adunit": "unit1"}}}]}}, - "mockResponse": {"status": 500, - "body": ""}}], - "expectedBidResponses": [], - "expectedMakeBidsErrors": [{"value": "unexpected status: 500", - "comparison": "literal"}]} +{ + "mockBidRequest":{ + "id":"req1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + }, + "httpCalls":[ + { + "expectedRequest":{ + "uri":"http://app.trustedmarketplace.com/processHeaderBid/unit1", + "body":{ + "id":"req1-unit1", + "imp":[ + { + "id":"imp1", + "banner":{ + "w":100, + "h":200 + }, + "ext":{ + "bidder":{ + "adunit":"unit1" + } + } + } + ] + } + }, + "mockResponse":{ + "status":500, + "body":"" + } + } + ], + "expectedBidResponses":[ + + ], + "expectedMakeBidsErrors":[ + { + "value":"unexpected status: 500", + "comparison":"literal" + } + ] +}