Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishshinde-pubm committed Jun 7, 2024
1 parent 46519db commit 7db6cea
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 1,042 deletions.
3 changes: 0 additions & 3 deletions adapters/ortbbidder/bidderparams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ type BidderConfig struct {

// setRequestParams sets the bidder specific requestParams
func (bcfg *BidderConfig) setRequestParams(bidderName string, requestParams map[string]BidderParamMapper) {
if bcfg.bidderConfigMap == nil {
bcfg.bidderConfigMap = make(map[string]*config)
}
if _, found := bcfg.bidderConfigMap[bidderName]; !found {
bcfg.bidderConfigMap[bidderName] = &config{}
}
Expand Down
30 changes: 0 additions & 30 deletions adapters/ortbbidder/bidderparams/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,13 @@ func TestSetRequestParams(t *testing.T) {
}
type want struct {
bidderCfg *BidderConfig
err error
}
tests := []struct {
name string
fields fields
args args
want want
}{
{
name: "bidderConfigMap_is_nil",
fields: fields{
bidderConfig: &BidderConfig{
bidderConfigMap: nil,
},
},
args: args{
bidderName: "test",
requestParams: map[string]BidderParamMapper{
"adunit": {
Location: "ext.adunit",
},
},
},
want: want{
bidderCfg: &BidderConfig{
bidderConfigMap: map[string]*config{
"test": {
requestParams: map[string]BidderParamMapper{
"adunit": {
Location: "ext.adunit",
},
},
},
},
},
},
},
{
name: "bidderName_not_found",
fields: fields{
Expand Down
2 changes: 1 addition & 1 deletion adapters/ortbbidder/ortbbidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ func (o *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
if o.bidderParamsConfig == nil {
return nil, []error{newBadInputError(errNilBidderParamCfg.Error())}
}
requestParams := o.bidderParamsConfig.GetRequestParams(o.bidderName.String())
requestBuilder := newRequestBuilder(o.adapterInfo.extraInfo.RequestMode, o.Endpoint)
err := requestBuilder.parseRequest(request)
if err != nil {
return nil, []error{newBadInputError(err.Error())}
}
requestParams := o.bidderParamsConfig.GetRequestParams(o.bidderName.String())
return requestBuilder.makeRequest(o.endpointTemplate, requestParams)
}

Expand Down
Loading

0 comments on commit 7db6cea

Please sign in to comment.