Skip to content

Commit

Permalink
fixed exchange tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxNode committed Apr 9, 2024
1 parent 28d1888 commit 5967366
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions exchange/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2106,11 +2106,10 @@ func loadFile(filename string) (*exchangeSpec, error) {
}

func runSpec(t *testing.T, filename string, spec *exchangeSpec) {
// aliases, errs := getRequestAliases(&spec.IncomingRequest.OrtbRequest)
// if len(errs) != 0 {
// t.Fatalf("%s: Failed to parse aliases", filename)
// }
aliases := map[string]string{}
aliases, err := parseRequestAliases(spec.IncomingRequest.OrtbRequest)
if err != nil {
t.Fatalf("%s: Failed to parse aliases", filename)
}

var s struct{}
eeac := make(map[string]struct{})
Expand Down Expand Up @@ -5783,6 +5782,24 @@ func (m *mockBidder) MakeBids(internalRequest *openrtb2.BidRequest, externalRequ
return args.Get(0).(*adapters.BidderResponse), args.Get(1).([]error)
}

func parseRequestAliases(r openrtb2.BidRequest) (map[string]string, error) {
if len(r.Ext) == 0 {
return nil, nil
}

ext := struct {
Prebid struct {
Aliases map[string]string `json:"aliases"`
} `json:"prebid"`
}{}

if err := jsonutil.Unmarshal(r.Ext, &ext); err != nil {
return nil, err
}

return ext.Prebid.Aliases, nil
}

func getInfoFromImp(req *openrtb_ext.RequestWrapper) (json.RawMessage, string, error) {
bidRequest := req.BidRequest
imp := bidRequest.Imp[0]
Expand Down

0 comments on commit 5967366

Please sign in to comment.