Skip to content

Commit

Permalink
Multi Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
osazos committed Jul 21, 2021
1 parent 473d9a6 commit 3533b2a
Show file tree
Hide file tree
Showing 13 changed files with 499 additions and 23 deletions.
2 changes: 1 addition & 1 deletion adapters/adagio/adagio.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, _ *adapters.Req
if activeExt.Prebid != nil && activeExt.Prebid.Type != "" {
bidType = activeExt.Prebid.Type
} else {
err := &errortypes.BadInput{
err := &errortypes.BadServerResponse{
Message: fmt.Sprintf("Failed to find native/banner/video mediaType \"%s\" ", activeBid.ImpID),
}
errs = append(errs, err)
Expand Down
7 changes: 4 additions & 3 deletions adapters/adagio/adagio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func TestMakeRequests_NoGzip(t *testing.T) {
assert.Equal(t, 1, len(requestData))

body := &openrtb2.BidRequest{}
_ = json.Unmarshal(requestData[0].Body, body)

error := json.Unmarshal(requestData[0].Body, body)
assert.NoError(t, error, "Request body unmarshalling error should be nil")
assert.Equal(t, 1, len(body.Imp))
}

Expand All @@ -69,6 +69,7 @@ func TestMakeRequests_Gzip(t *testing.T) {
t.Fatalf("Builder returned unexpected error %v", buildErr)
}

requestData, _ := bidder.MakeRequests(&fakeBidRequest, nil)
requestData, errors := bidder.MakeRequests(&fakeBidRequest, nil)
assert.Empty(t, errors, "Got errors while making requests")
assert.Equal(t, []string([]string{"gzip"}), requestData[0].Headers["Content-Encoding"])
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@
},
"imp": [
{
"id": "some-impression-id",
"id": "multi-format-id",
"banner": {
"w":320,
"h":50
},
"video": {
"mimes": ["video\/mp4"],
"w": 640,
"h": 480
},
"ext": {
"bidder": {
"organizationId": "1000",
Expand Down Expand Up @@ -61,11 +66,16 @@
},
"imp": [
{
"id": "some-impression-id",
"id": "multi-format-id",
"banner": {
"w":320,
"h":50
},
"video": {
"mimes": ["video\/mp4"],
"w": 640,
"h": 480
},
"ext": {
"bidder": {
"organizationId": "1000",
Expand Down Expand Up @@ -96,7 +106,7 @@
"bid": [
{
"id": "a3ae1b4e2fc24a4fb45540082e98e161",
"impid": "some-impression-id",
"impid": "multi-format-id",
"price": 3.5,
"adm": "awesome-markup",
"adomain": [
Expand All @@ -106,11 +116,6 @@
"w": 320,
"h": 50,
"ext": {
"adagio": {
"outstream": {
"bvwUrl": "https://cool.io"
}
},
"prebid": {
"type": "banner"
}
Expand All @@ -137,7 +142,7 @@
{
"bid": {
"id": "a3ae1b4e2fc24a4fb45540082e98e161",
"impid": "some-impression-id",
"impid": "multi-format-id",
"price": 3.5,
"adm": "awesome-markup",
"crid": "20",
Expand All @@ -147,11 +152,6 @@
"w": 320,
"h": 50,
"ext": {
"adagio": {
"outstream": {
"bvwUrl": "https://cool.io"
}
},
"prebid": {
"type": "banner"
}
Expand Down
10 changes: 10 additions & 0 deletions adapters/adagio/adagiotest/exemplary/video-web.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
"w": 1280,
"h": 720,
"ext": {
"adagio": {
"outstream": {
"bvwUrl": "https://cool.io"
}
},
"prebid": {
"type": "video"
}
Expand Down Expand Up @@ -152,6 +157,11 @@
"w": 1280,
"h": 720,
"ext": {
"adagio": {
"outstream": {
"bvwUrl": "https://cool.io"
}
},
"prebid": {
"type": "video"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
{
"id": "some-impression-id",
"banner": {
"w":320,
"h":50
"w": 320,
"h": 50
},
"ext": {
"bidder": {
Expand Down Expand Up @@ -63,8 +63,8 @@
{
"id": "some-impression-id",
"banner": {
"w":320,
"h":50
"w": 320,
"h": 50
},
"ext": {
"bidder": {
Expand Down Expand Up @@ -124,7 +124,7 @@
],
"expectedBidResponses": [
{
"bids":[]
"bids": []
}
]
}
62 changes: 62 additions & 0 deletions adapters/adagio/adagiotest/supplemental/status-204.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"mockBidRequest": {
"test": 1,
"id": "some-request-id",
"imp": [
{
"id": "some-impression-id",
"banner": {
"w": 320,
"h": 50
},
"ext": {
"bidder": {
"organizationId": "1000",
"site": "site-name",
"placement": "ban_atf"
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
]
},
"uri": "http://localhost/prebid_server",
"body": {
"test": 1,
"id": "some-request-id",
"imp": [
{
"id": "some-impression-id",
"banner": {
"w": 320,
"h": 50
},
"ext": {
"bidder": {
"organizationId": "1000",
"site": "site-name",
"placement": "ban_atf"
}
}
}
]
}
},
"mockResponse": {
"status": 204,
"body": {}
}
}
],
"expectedBidResponses": []
}
67 changes: 67 additions & 0 deletions adapters/adagio/adagiotest/supplemental/status-400.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"mockBidRequest": {
"test": 1,
"id": "some-request-id",
"imp": [
{
"id": "some-impression-id",
"banner": {
"w": 320,
"h": 50
},
"ext": {
"bidder": {
"organizationId": "1000",
"site": "site-name",
"placement": "ban_atf"
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
]
},
"uri": "http://localhost/prebid_server",
"body": {
"test": 1,
"id": "some-request-id",
"imp": [
{
"id": "some-impression-id",
"banner": {
"w": 320,
"h": 50
},
"ext": {
"bidder": {
"organizationId": "1000",
"site": "site-name",
"placement": "ban_atf"
}
}
}
]
}
},
"mockResponse": {
"status": 400,
"body": "bad request"
}
}
],
"expectedMakeBidsErrors": [
{
"value": "Unexpected status code: 400. Run with request.debug = 1 for more info",
"comparison": "literal"
}
]
}
67 changes: 67 additions & 0 deletions adapters/adagio/adagiotest/supplemental/status-401.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"mockBidRequest": {
"test": 1,
"id": "some-request-id",
"imp": [
{
"id": "some-impression-id",
"banner": {
"w": 320,
"h": 50
},
"ext": {
"bidder": {
"organizationId": "1000",
"site": "site-name",
"placement": "ban_atf"
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
]
},
"uri": "http://localhost/prebid_server",
"body": {
"test": 1,
"id": "some-request-id",
"imp": [
{
"id": "some-impression-id",
"banner": {
"w": 320,
"h": 50
},
"ext": {
"bidder": {
"organizationId": "1000",
"site": "site-name",
"placement": "ban_atf"
}
}
}
]
}
},
"mockResponse": {
"status": 401,
"body": "unauthorized"
}
}
],
"expectedMakeBidsErrors": [
{
"value": "Unexpected status code: 401. Run with request.debug = 1 for more info",
"comparison": "literal"
}
]
}
Loading

0 comments on commit 3533b2a

Please sign in to comment.