Skip to content

Commit

Permalink
Merge branch 'master' into OTT-48
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-shriprasad-marathe committed Feb 16, 2021
2 parents b76d1a4 + 6fcee64 commit 54b073e
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 1 deletion.
152 changes: 152 additions & 0 deletions adapters/pubmatic/pubmatictest/supplemental/trimPublisherID.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [{
"id": "test-imp-id",
"banner": {
"format": [{
"w": 300,
"h": 250
}]
},
"ext": {
"bidder": {
"adSlot": "AdTag_Div1@300x250",
"publisherId": " 999 ",
"keywords": [{
"key": "pmZoneID",
"value": ["Zone1", "Zone2"]
},
{
"key": "preference",
"value": ["sports", "movies"]
}
],
"wrapper": {
"version": 1,
"profile": 5123
}
}
}
}],
"device":{
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
},
"site": {
"id": "siteID",
"publisher": {
"id": "1234"
}
},
"ext":{
"prebid" :{
"bidderparams": {
"wiid": "dwzafakjflan-tygannnvlla-mlljvj"
}
}
}
},

"httpCalls": [
{
"expectedRequest": {
"uri": "https://hbopenbid.pubmatic.com/translator?source=prebid-server",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"tagid":"AdTag_Div1",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
],
"h": 250,
"w": 300
},
"ext": {
"pmZoneID": "Zone1,Zone2",
"preference": "sports,movies"
}
}
],
"device":{
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
},
"site": {
"id": "siteID",
"publisher": {
"id": "999"
}
},
"ext": {
"wrapper": {
"profile": 5123,
"version":1,
"wiid" : "dwzafakjflan-tygannnvlla-mlljvj"
}
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "958",
"bid": [{
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.500000,
"adid": "29681110",
"adm": "some-test-ad",
"adomain": ["pubmatic.com"],
"crid": "29681110",
"h": 250,
"w": 300,
"dealid":"test deal",
"ext": {
"dspid": 6,
"deal_channel": 1
}
}]
}
],
"bidid": "5778926625248726496",
"cur": "USD"
}
}
}
],

"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.5,
"adid": "29681110",
"adm": "some-test-ad",
"adomain": ["pubmatic.com"],
"crid": "29681110",
"w": 300,
"h": 250,
"dealid":"test deal",
"ext": {
"dspid": 6,
"deal_channel": 1
}
},
"type": "banner"
}
]
}
]
}
1 change: 0 additions & 1 deletion exchange/adapter_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter
cfg.Adapters[string(openrtb_ext.BidderRubicon)].XAPI.Username,
cfg.Adapters[string(openrtb_ext.BidderRubicon)].XAPI.Password,
cfg.Adapters[string(openrtb_ext.BidderRubicon)].XAPI.Tracker),

openrtb_ext.BidderSharethrough: sharethrough.NewSharethroughBidder(cfg.Adapters[string(openrtb_ext.BidderSharethrough)].Endpoint),
openrtb_ext.BidderSilverMob: silvermob.NewSilverMobBidder(cfg.Adapters[string(openrtb_ext.BidderSilverMob)].Endpoint),
openrtb_ext.BidderSmaato: smaato.NewSmaatoBidder(cfg.Adapters[string(openrtb_ext.BidderSmaato)].Endpoint),
Expand Down
27 changes: 27 additions & 0 deletions exchange/bidder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,33 @@ func wrapWithBidderInfo(bidder adapters.Bidder) adapters.Bidder {
},
},
}
}

var loggerBuffer bytes.Buffer
logger := func(msg string, args ...interface{}) {
loggerBuffer.WriteString(fmt.Sprintf(fmt.Sprintln(msg), args...))
}

bidderAdapter.doRequestImpl(ctx, &bidRequest, logger)

// Wait a little longer than the 205ms mock server sleep.
time.Sleep(210 * time.Millisecond)

logExpected := "TimeoutNotification: error:(context deadline exceeded) body:\n"
logActual := loggerBuffer.String()
assert.EqualValues(t, logExpected, logActual)
}

func wrapWithBidderInfo(bidder adapters.Bidder) adapters.Bidder {
bidderInfo := adapters.BidderInfo{
Status: adapters.StatusActive,
Capabilities: &adapters.CapabilitiesInfo{
App: &adapters.PlatformInfo{
MediaTypes: []openrtb_ext.BidType{openrtb_ext.BidTypeBanner},
},
},
}
>>>>>>> master
return adapters.EnforceBidderInfo(bidder, bidderInfo)
}

Expand Down

0 comments on commit 54b073e

Please sign in to comment.