diff --git a/exchange/exchange.go b/exchange/exchange.go index 41134104f37..ef38736388d 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -105,7 +105,7 @@ type bidResponseWrapper struct { } type BidIDGenerator interface { - New() (string, error) + New(bidder string) (string, error) Enabled() bool } @@ -117,7 +117,7 @@ func (big *bidIDGenerator) Enabled() bool { return big.enabled } -func (big *bidIDGenerator) New() (string, error) { +func (big *bidIDGenerator) New(bidder string) (string, error) { rawUuid, err := uuid.NewV4() return rawUuid.String(), err } @@ -416,10 +416,11 @@ func (e *exchange) HoldAuction(ctx context.Context, r *AuctionRequest, debugLog } if e.bidIDGenerator.Enabled() { - for _, seatBid := range adapterBids { - for _, pbsBid := range seatBid.Bids { - pbsBid.GeneratedBidID, err = e.bidIDGenerator.New() - if err != nil { + for bidder, seatBid := range adapterBids { + for i := range seatBid.Bids { + if bidID, err := e.bidIDGenerator.New(bidder.String()); err == nil { + seatBid.Bids[i].GeneratedBidID = bidID + } else { errs = append(errs, errors.New("Error generating bid.ext.prebid.bidid")) } } diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 9156fc06c78..78bc167b770 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -663,7 +663,7 @@ func TestOverrideWithCustomCurrency(t *testing.T) { }.Builder e.currencyConverter = mockCurrencyConverter e.categoriesFetcher = categoriesFetcher - e.bidIDGenerator = &mockBidIDGenerator{false, false} + e.bidIDGenerator = &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false} e.requestSplitter = requestSplitter{ me: e.me, gdprPermsBuilder: e.gdprPermsBuilder, @@ -768,7 +768,7 @@ func TestAdapterCurrency(t *testing.T) { }.Builder, currencyConverter: currencyConverter, categoriesFetcher: nilCategoryFetcher{}, - bidIDGenerator: &mockBidIDGenerator{false, false}, + bidIDGenerator: &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false}, adapterMap: map[openrtb_ext.BidderName]AdaptedBidder{ openrtb_ext.BidderName("appnexus"): AdaptBidder(mockBidder, nil, &config.Configuration{}, &metricsConfig.NilMetricsEngine{}, openrtb_ext.BidderName("appnexus"), nil, ""), }, @@ -846,7 +846,7 @@ func TestFloorsSignalling(t *testing.T) { }.Builder, currencyConverter: currencyConverter, categoriesFetcher: nilCategoryFetcher{}, - bidIDGenerator: &mockBidIDGenerator{false, false}, + bidIDGenerator: &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false}, priceFloorEnabled: true, priceFloorFetcher: &mockPriceFloorFetcher{}, } @@ -1129,7 +1129,7 @@ func TestReturnCreativeEndToEnd(t *testing.T) { }.Builder e.currencyConverter = currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) e.categoriesFetcher = categoriesFetcher - e.bidIDGenerator = &mockBidIDGenerator{false, false} + e.bidIDGenerator = &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false} e.requestSplitter = requestSplitter{ me: e.me, gdprPermsBuilder: e.gdprPermsBuilder, @@ -2139,9 +2139,9 @@ func runSpec(t *testing.T, filename string, spec *exchangeSpec) { }, }, } - bidIdGenerator := &mockBidIDGenerator{} + bidIdGenerator := &fakeBidIDGenerator{} if spec.BidIDGenerator != nil { - *bidIdGenerator = *spec.BidIDGenerator + bidIdGenerator = spec.BidIDGenerator } ex := newExchangeForTests(t, filename, spec.OutgoingRequests, aliases, privacyConfig, bidIdGenerator, spec.HostSChainFlag, spec.FloorsEnabled, spec.HostConfigBidValidation, spec.Server) biddersInAuction := findBiddersInAuction(t, filename, &spec.IncomingRequest.OrtbRequest) @@ -2457,31 +2457,35 @@ func newExchangeForTests(t *testing.T, filename string, expectations map[string] } } -type mockBidIDGenerator struct { +type fakeBidIDGenerator struct { GenerateBidID bool `json:"generateBidID"` ReturnError bool `json:"returnError"` + bidCount map[string]int } -func (big *mockBidIDGenerator) Enabled() bool { - return big.GenerateBidID +func (f *fakeBidIDGenerator) Enabled() bool { + return f.GenerateBidID } -func (big *mockBidIDGenerator) New() (string, error) { +func (f *fakeBidIDGenerator) New(bidder string) (string, error) { + if f.ReturnError { + return "", errors.New("Test error generating bid.ext.prebid.bidid") + } - if big.ReturnError { - err := errors.New("Test error generating bid.ext.prebid.bidid") - return "", err + if f.bidCount == nil { + f.bidCount = make(map[string]int) } - return "mock_uuid", nil + f.bidCount[bidder] += 1 + return fmt.Sprintf("bid-%v-%v", bidder, f.bidCount[bidder]), nil } -type fakeRandomDeduplicateBidBooleanGenerator struct { - returnValue bool +type fakeBooleanGenerator struct { + value bool } -func (m *fakeRandomDeduplicateBidBooleanGenerator) Generate() bool { - return m.returnValue +func (f *fakeBooleanGenerator) Generate() bool { + return f.value } func newExtRequest() openrtb_ext.ExtRequest { @@ -2849,7 +2853,7 @@ func TestCategoryDedupe(t *testing.T) { Currency: "USD", }, } - deduplicateGenerator := fakeRandomDeduplicateBidBooleanGenerator{returnValue: tt.dedupeGeneratorValue} + deduplicateGenerator := fakeBooleanGenerator{value: tt.dedupeGeneratorValue} bidCategory, adapterBids, rejections, err := applyCategoryMapping(nil, *requestExt.Prebid.Targeting, adapterBids, categoriesFetcher, targData, &deduplicateGenerator, &nonBids{}) assert.Nil(t, err) @@ -3286,7 +3290,7 @@ func TestCategoryMappingTwoBiddersManyBidsEachNoCategorySamePrice(t *testing.T) adapterBids[bidderNameApn1] = &seatBidApn1 adapterBids[bidderNameApn2] = &seatBidApn2 - _, adapterBids, rejections, err := applyCategoryMapping(nil, *requestExt.Prebid.Targeting, adapterBids, categoriesFetcher, targData, &fakeRandomDeduplicateBidBooleanGenerator{true}, &nonBids{}) + _, adapterBids, rejections, err := applyCategoryMapping(nil, *requestExt.Prebid.Targeting, adapterBids, categoriesFetcher, targData, &fakeBooleanGenerator{value: true}, &nonBids{}) assert.NoError(t, err, "Category mapping error should be empty") @@ -4110,7 +4114,7 @@ func TestStoredAuctionResponses(t *testing.T) { e.cache = &wellBehavedCache{} e.me = &metricsConf.NilMetricsEngine{} e.categoriesFetcher = categoriesFetcher - e.bidIDGenerator = &mockBidIDGenerator{false, false} + e.bidIDGenerator = &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false} e.currencyConverter = currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) e.gdprPermsBuilder = fakePermissionsBuilder{ permissions: &permissionsMock{ @@ -4476,7 +4480,7 @@ func TestAuctionDebugEnabled(t *testing.T) { e.cache = &wellBehavedCache{} e.me = &metricsConf.NilMetricsEngine{} e.categoriesFetcher = categoriesFetcher - e.bidIDGenerator = &mockBidIDGenerator{false, false} + e.bidIDGenerator = &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false} e.currencyConverter = currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) e.gdprPermsBuilder = fakePermissionsBuilder{ permissions: &permissionsMock{ @@ -5077,7 +5081,7 @@ func TestOverrideConfigAlternateBidderCodesWithRequestValues(t *testing.T) { }.Builder e.currencyConverter = currency.NewRateConverter(&http.Client{}, "", time.Duration(0)) e.categoriesFetcher = categoriesFetcher - e.bidIDGenerator = &mockBidIDGenerator{false, false} + e.bidIDGenerator = &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false} e.requestSplitter = requestSplitter{ me: e.me, gdprPermsBuilder: e.gdprPermsBuilder, @@ -5474,7 +5478,7 @@ type exchangeSpec struct { DebugLog *DebugLog `json:"debuglog,omitempty"` EventsEnabled bool `json:"events_enabled,omitempty"` StartTime int64 `json:"start_time_ms,omitempty"` - BidIDGenerator *mockBidIDGenerator `json:"bidIDGenerator,omitempty"` + BidIDGenerator *fakeBidIDGenerator `json:"bidIDGenerator,omitempty"` RequestType *metrics.RequestType `json:"requestType,omitempty"` PassthroughFlag bool `json:"passthrough_flag,omitempty"` HostSChainFlag bool `json:"host_schain_flag,omitempty"` diff --git a/exchange/exchangetest/bid-id-invalid.json b/exchange/exchangetest/bid-id-invalid.json deleted file mode 100644 index 9b3c5eee245..00000000000 --- a/exchange/exchangetest/bid-id-invalid.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "bidIDGenerator": { - "generateBidID": true, - "returnError": true - }, - "incomingRequest": { - "ortbRequest": { - "id": "some-request-id", - "site": { - "page": "test.somepage.com" - }, - "imp": [ - { - "id": "my-imp-id", - "video": { - "mimes": [ - "video/mp4" - ] - }, - "ext": { - "prebid": { - "bidder": { - "appnexus": { - "placementId": 1 - } - } - } - } - } - ], - "test": 1, - "ext": { - "prebid": { - "targeting": { - "includebrandcategory": { - "primaryadserver": 1, - "publisher": "", - "withcategory": true - }, - "pricegranularity": { - "precision": 2, - "ranges": [ - { - "min": 0, - "max": 20, - "increment": 0.1 - } - ] - }, - "includewinners": true, - "includebidderkeys": true, - "appendbiddernames": true - } - } - } - }, - "usersyncs": { - "appnexus": "123" - } - }, - "outgoingRequests": { - "appnexus": { - "mockResponse": { - "pbsSeatBids": [ - { - "pbsBids": [ - { - "ortbBid": { - "id": "apn-bid", - "impid": "my-imp-id", - "price": 0.3, - "w": 200, - "h": 250, - "crid": "creative-1", - "cat": [ - "IAB1-1" - ] - }, - "bidType": "video", - "bidVideo": { - "duration": 30, - "PrimaryCategory": "" - } - } - ], - "seat": "appnexus" - } - ] - } - } - }, - "response": { - "bids": { - "id": "some-request-id", - "seatbid": [ - { - "seat": "appnexus", - "bid": [ - { - "id": "apn-bid", - "impid": "my-imp-id", - "price": 0.3, - "w": 200, - "h": 250, - "crid": "creative-1", - "cat": [ - "IAB1-1" - ], - "ext": { - "origbidcpm": 0.3, - "prebid": { - "meta": { - "adaptercode":"appnexus" - }, - "type": "video", - "targeting": { - "hb_bidder": "appnexus", - "hb_bidder_appnexus": "appnexus", - "hb_cache_host": "www.pbcserver.com", - "hb_cache_host_appnex": "www.pbcserver.com", - "hb_cache_path": "/pbcache/endpoint", - "hb_cache_path_appnex": "/pbcache/endpoint", - "hb_pb": "0.20", - "hb_pb_appnexus": "0.20", - "hb_pb_cat_dur": "0.20_VideoGames_0s_appnexus", - "hb_pb_cat_dur_appnex": "0.20_VideoGames_0s_appnexus", - "hb_size": "200x250", - "hb_size_appnexus": "200x250" - } - } - } - } - ] - } - ] - }, - "ext": { - "debug": { - "resolvedrequest": { - "id": "some-request-id", - "imp": [ - { - "id": "my-imp-id", - "video": { - "mimes": [ - "video/mp4" - ] - }, - "ext": { - "prebid": { - "bidder": { - "appnexus": { - "placementId": 1 - } - } - } - } - } - ], - "site": { - "page": "test.somepage.com" - }, - "test": 1, - "ext": { - "prebid": { - "targeting": { - "includebrandcategory": { - "primaryadserver": 1, - "publisher": "", - "withcategory": true - }, - "pricegranularity": { - "precision": 2, - "ranges": [ - { - "min": 0, - "max": 20, - "increment": 0.1 - } - ] - }, - "includewinners": true, - "includebidderkeys": true, - "appendbiddernames": true - } - } - } - } - }, - "errors": { - "prebid": [ - { - "code": 999, - "message": "Error generating bid.ext.prebid.bidid" - } - ] - } - } - } -} \ No newline at end of file diff --git a/exchange/exchangetest/bid-id-valid.json b/exchange/exchangetest/bid-id-valid.json deleted file mode 100644 index caa02384025..00000000000 --- a/exchange/exchangetest/bid-id-valid.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "bidIDGenerator": { - "generateBidID": true, - "returnError": false - }, - "incomingRequest": { - "ortbRequest": { - "id": "some-request-id", - "site": { - "page": "test.somepage.com" - }, - "imp": [ - { - "id": "my-imp-id", - "video": { - "mimes": [ - "video/mp4" - ] - }, - "ext": { - "prebid": { - "bidder": { - "appnexus": { - "placementId": 1 - } - } - } - } - } - ], - "test": 1, - "ext": { - "prebid": { - "targeting": { - "includebrandcategory": { - "primaryadserver": 1, - "publisher": "", - "withcategory": true - }, - "pricegranularity": { - "precision": 2, - "ranges": [ - { - "min": 0, - "max": 20, - "increment": 0.1 - } - ] - }, - "includewinners": true, - "includebidderkeys": true, - "appendbiddernames": true - } - } - } - }, - "usersyncs": { - "appnexus": "123" - } - }, - "outgoingRequests": { - "appnexus": { - "mockResponse": { - "pbsSeatBids": [ - { - "pbsBids": [ - { - "ortbBid": { - "id": "apn-bid", - "impid": "my-imp-id", - "price": 0.3, - "w": 200, - "h": 250, - "crid": "creative-1", - "cat": [ - "IAB1-1" - ] - }, - "bidType": "video", - "bidVideo": { - "duration": 30, - "PrimaryCategory": "" - } - } - ], - "seat": "appnexus" - } - ] - } - } - }, - "response": { - "bids": { - "id": "some-request-id", - "seatbid": [ - { - "seat": "appnexus", - "bid": [ - { - "id": "apn-bid", - "impid": "my-imp-id", - "price": 0.3, - "w": 200, - "h": 250, - "crid": "creative-1", - "cat": [ - "IAB1-1" - ], - "ext": { - "origbidcpm": 0.3, - "prebid": { - "meta": { - "adaptercode":"appnexus" - }, - "bidid": "mock_uuid", - "type": "video", - "targeting": { - "hb_bidder": "appnexus", - "hb_bidder_appnexus": "appnexus", - "hb_cache_host": "www.pbcserver.com", - "hb_cache_host_appnex": "www.pbcserver.com", - "hb_cache_path": "/pbcache/endpoint", - "hb_cache_path_appnex": "/pbcache/endpoint", - "hb_pb": "0.20", - "hb_pb_appnexus": "0.20", - "hb_pb_cat_dur": "0.20_VideoGames_0s_appnexus", - "hb_pb_cat_dur_appnex": "0.20_VideoGames_0s_appnexus", - "hb_size": "200x250", - "hb_size_appnexus": "200x250" - } - } - } - } - ] - } - ] - }, - "ext": { - "debug": { - "resolvedrequest": { - "id": "some-request-id", - "imp": [ - { - "id": "my-imp-id", - "video": { - "mimes": [ - "video/mp4" - ] - }, - "ext": { - "prebid": { - "bidder": { - "appnexus": { - "placementId": 1 - } - } - } - } - } - ], - "site": { - "page": "test.somepage.com" - }, - "test": 1, - "ext": { - "prebid": { - "targeting": { - "pricegranularity": { - "precision": 2, - "ranges": [ - { - "min": 0, - "max": 20, - "increment": 0.1 - } - ] - }, - "includewinners": true, - "includebidderkeys": true, - "includebrandcategory": { - "primaryadserver": 1, - "publisher": "", - "withcategory": true - }, - "appendbiddernames": true - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/exchange/exchangetest/events-vast-account-off-request-on.json b/exchange/exchangetest/events-vast-account-off-request-on.json index 1a5aea4217f..93ec6f35d07 100644 --- a/exchange/exchangetest/events-vast-account-off-request-on.json +++ b/exchange/exchangetest/events-vast-account-off-request-on.json @@ -134,7 +134,7 @@ "meta": { "adaptercode": "audienceNetwork" }, - "bidid": "mock_uuid", + "bidid": "bid-audienceNetwork-1", "type": "video" } } @@ -146,7 +146,7 @@ "bid": [ { "id": "winning-bid", - "adm": "prebid.org wrapper", + "adm": "prebid.org wrapper", "nurl": "http://domain.com/winning-bid", "impid": "my-imp-id", "price": 0.71, @@ -156,10 +156,10 @@ "ext": { "origbidcpm": 0.71, "prebid": { - "bidid": "mock_uuid", "meta": { "adaptercode": "appnexus" }, + "bidid": "bid-appnexus-1", "type": "video", "targeting": { "hb_bidder": "appnexus", @@ -174,7 +174,7 @@ }, { "id": "losing-bid", - "adm": "prebid.org wrapper", + "adm": "prebid.org wrapper", "nurl": "http://domain.com/losing-bid", "impid": "my-imp-id", "price": 0.21, @@ -187,7 +187,7 @@ "meta": { "adaptercode": "appnexus" }, - "bidid": "mock_uuid", + "bidid": "bid-appnexus-2", "type": "video" } } diff --git a/exchange/exchangetest/generate-bid-id-error.json b/exchange/exchangetest/generate-bid-id-error.json new file mode 100644 index 00000000000..9c13ef38895 --- /dev/null +++ b/exchange/exchangetest/generate-bid-id-error.json @@ -0,0 +1,200 @@ +{ + "bidIDGenerator": { + "generateBidID": true, + "returnError": true + }, + "incomingRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [ + { + "id": "my-imp-id", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 1 + } + } + } + } + } + ], + "test": 1, + "ext": { + "prebid": { + "targeting": { + "includebrandcategory": { + "primaryadserver": 1, + "publisher": "", + "withcategory": true + }, + "pricegranularity": { + "precision": 2, + "ranges": [ + { + "min": 0, + "max": 20, + "increment": 0.1 + } + ] + }, + "includewinners": true, + "includebidderkeys": true, + "appendbiddernames": true + } + } + } + }, + "usersyncs": { + "appnexus": "123" + } + }, + "outgoingRequests": { + "appnexus": { + "mockResponse": { + "pbsSeatBids": [ + { + "pbsBids": [ + { + "ortbBid": { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ] + }, + "bidType": "video", + "bidVideo": { + "duration": 30, + "PrimaryCategory": "" + } + } + ], + "seat": "appnexus" + } + ] + } + } + }, + "response": { + "bids": { + "id": "some-request-id", + "seatbid": [ + { + "seat": "appnexus", + "bid": [ + { + "id": "apn-bid", + "impid": "my-imp-id", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ], + "ext": { + "origbidcpm": 0.3, + "prebid": { + "meta": { + "adaptercode": "appnexus" + }, + "type": "video", + "targeting": { + "hb_bidder": "appnexus", + "hb_bidder_appnexus": "appnexus", + "hb_cache_host": "www.pbcserver.com", + "hb_cache_host_appnex": "www.pbcserver.com", + "hb_cache_path": "/pbcache/endpoint", + "hb_cache_path_appnex": "/pbcache/endpoint", + "hb_pb": "0.20", + "hb_pb_appnexus": "0.20", + "hb_pb_cat_dur": "0.20_VideoGames_0s_appnexus", + "hb_pb_cat_dur_appnex": "0.20_VideoGames_0s_appnexus", + "hb_size": "200x250", + "hb_size_appnexus": "200x250" + } + } + } + } + ] + } + ] + }, + "ext": { + "debug": { + "resolvedrequest": { + "id": "some-request-id", + "imp": [ + { + "id": "my-imp-id", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 1 + } + } + } + } + } + ], + "site": { + "page": "test.somepage.com" + }, + "test": 1, + "ext": { + "prebid": { + "targeting": { + "includebrandcategory": { + "primaryadserver": 1, + "publisher": "", + "withcategory": true + }, + "pricegranularity": { + "precision": 2, + "ranges": [ + { + "min": 0, + "max": 20, + "increment": 0.1 + } + ] + }, + "includewinners": true, + "includebidderkeys": true, + "appendbiddernames": true + } + } + } + } + }, + "errors": { + "prebid": [ + { + "code": 999, + "message": "Error generating bid.ext.prebid.bidid" + } + ] + } + } + } +} \ No newline at end of file diff --git a/exchange/exchangetest/generate-bid-id-many.json b/exchange/exchangetest/generate-bid-id-many.json new file mode 100644 index 00000000000..4c6a18ab174 --- /dev/null +++ b/exchange/exchangetest/generate-bid-id-many.json @@ -0,0 +1,163 @@ +{ + "bidIDGenerator": { + "generateBidID": true, + "returnError": false + }, + "incomingRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [ + { + "id": "imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 1 + } + } + } + } + } + ] + } + }, + "outgoingRequests": { + "appnexus": { + "mockResponse": { + "pbsSeatBids": [ + { + "pbsBids": [ + { + "ortbBid": { + "id": "apn-bid-1", + "impid": "imp-id-1", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ] + }, + "bidType": "video", + "bidVideo": { + "duration": 30 + } + }, + { + "ortbBid": { + "id": "apn-bid-2", + "impid": "imp-id-1", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ] + }, + "bidType": "video", + "bidVideo": { + "duration": 30 + } + } + ], + "seat": "appnexus" + } + ] + } + } + }, + "response": { + "bids": { + "id": "some-request-id", + "seatbid": [ + { + "seat": "appnexus", + "bid": [ + { + "id": "apn-bid-1", + "impid": "imp-id-1", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ], + "ext": { + "origbidcpm": 0.3, + "prebid": { + "meta": { + "adaptercode": "appnexus" + }, + "bidid": "bid-appnexus-1", + "type": "video" + } + } + }, + { + "id": "apn-bid-2", + "impid": "imp-id-1", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ], + "ext": { + "origbidcpm": 0.3, + "prebid": { + "meta": { + "adaptercode": "appnexus" + }, + "bidid": "bid-appnexus-2", + "type": "video" + } + } + } + ] + } + ] + }, + "ext": { + "debug": { + "resolvedrequest": { + "id": "some-request-id", + "imp": [ + { + "id": "imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 1 + } + } + } + } + } + ], + "site": { + "page": "test.somepage.com" + } + } + } + } + } +} \ No newline at end of file diff --git a/exchange/exchangetest/generate-bid-id-one.json b/exchange/exchangetest/generate-bid-id-one.json new file mode 100644 index 00000000000..7d4169d635d --- /dev/null +++ b/exchange/exchangetest/generate-bid-id-one.json @@ -0,0 +1,125 @@ +{ + "bidIDGenerator": { + "generateBidID": true, + "returnError": false + }, + "incomingRequest": { + "ortbRequest": { + "id": "some-request-id", + "site": { + "page": "test.somepage.com" + }, + "imp": [ + { + "id": "imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 1 + } + } + } + } + } + ] + } + }, + "outgoingRequests": { + "appnexus": { + "mockResponse": { + "pbsSeatBids": [ + { + "pbsBids": [ + { + "ortbBid": { + "id": "apn-bid", + "impid": "imp-id-1", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ] + }, + "bidType": "video", + "bidVideo": { + "duration": 30 + } + } + ], + "seat": "appnexus" + } + ] + } + } + }, + "response": { + "bids": { + "id": "some-request-id", + "seatbid": [ + { + "seat": "appnexus", + "bid": [ + { + "id": "apn-bid", + "impid": "imp-id-1", + "price": 0.3, + "w": 200, + "h": 250, + "crid": "creative-1", + "cat": [ + "IAB1-1" + ], + "ext": { + "origbidcpm": 0.3, + "prebid": { + "meta": { + "adaptercode": "appnexus" + }, + "bidid": "bid-appnexus-1", + "type": "video" + } + } + } + ] + } + ] + }, + "ext": { + "debug": { + "resolvedrequest": { + "id": "some-request-id", + "imp": [ + { + "id": "imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ] + }, + "ext": { + "prebid": { + "bidder": { + "appnexus": { + "placementId": 1 + } + } + } + } + } + ], + "site": { + "page": "test.somepage.com" + } + } + } + } + } +} \ No newline at end of file diff --git a/exchange/targeting_test.go b/exchange/targeting_test.go index e6cc429e8ea..13a7572a182 100644 --- a/exchange/targeting_test.go +++ b/exchange/targeting_test.go @@ -102,7 +102,7 @@ func runTargetingAuction(t *testing.T, mockBids map[openrtb_ext.BidderName][]*op currencyConverter: currency.NewRateConverter(&http.Client{}, "", time.Duration(0)), gdprDefaultValue: gdpr.SignalYes, categoriesFetcher: categoriesFetcher, - bidIDGenerator: &mockBidIDGenerator{false, false}, + bidIDGenerator: &fakeBidIDGenerator{GenerateBidID: false, ReturnError: false}, } ex.requestSplitter = requestSplitter{ me: ex.me,