Skip to content

Commit

Permalink
Smaato: Add ORTB2.6 tests (#3646)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan S authored Jun 5, 2024
1 parent 32fdbc4 commit 7702a78
Show file tree
Hide file tree
Showing 31 changed files with 296 additions and 152 deletions.
30 changes: 2 additions & 28 deletions adapters/smaato/smaato.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import (
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/metrics"
"github.com/prebid/prebid-server/v2/openrtb_ext"
"github.com/prebid/prebid-server/v2/util/ptrutil"
"github.com/prebid/prebid-server/v2/util/timeutil"
)

const clientVersion = "prebid_server_0.6"
const clientVersion = "prebid_server_0.7"

type adMarkupType string

Expand Down Expand Up @@ -471,18 +470,7 @@ func setImpForAdspace(imp *openrtb2.Imp) error {
return err
}

if imp.Banner != nil {
bannerCopy, err := setBannerDimension(imp.Banner)
if err != nil {
return err
}
imp.Banner = bannerCopy
imp.TagID = adSpaceID
imp.Ext = impExt
return nil
}

if imp.Video != nil || imp.Native != nil {
if imp.Banner != nil || imp.Video != nil || imp.Native != nil {
imp.TagID = adSpaceID
imp.Ext = impExt
return nil
Expand Down Expand Up @@ -545,20 +533,6 @@ func makeImpExt(impExtRaw *json.RawMessage) (json.RawMessage, error) {
}
}

func setBannerDimension(banner *openrtb2.Banner) (*openrtb2.Banner, error) {
if banner.W != nil && banner.H != nil {
return banner, nil
}
if len(banner.Format) == 0 {
return banner, &errortypes.BadInput{Message: "No sizes provided for Banner."}
}
bannerCopy := *banner
bannerCopy.W = ptrutil.ToPtr(banner.Format[0].W)
bannerCopy.H = ptrutil.ToPtr(banner.Format[0].H)

return &bannerCopy, nil
}

func groupImpressionsByPod(imps []openrtb2.Imp) (map[string]([]openrtb2.Imp), []string, []error) {
pods := make(map[string][]openrtb2.Imp)
orderKeys := make([]string, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@
"tagid": "130563103",
"bidfloor": 0.00123,
"banner": {
"h": 50,
"w": 320,
"format": [
{
"w": 320,
Expand Down Expand Up @@ -203,7 +201,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"]
Expand Down Expand Up @@ -349,7 +347,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["postbid_iframe"]
Expand Down Expand Up @@ -509,4 +507,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@
"tagid": "130563103",
"bidfloor": 0.00123,
"banner": {
"h": 50,
"w": 320,
"format": [
{
"w": 320,
Expand Down Expand Up @@ -162,7 +160,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"]
Expand Down Expand Up @@ -269,7 +267,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["postbid_iframe"]
Expand Down Expand Up @@ -357,4 +355,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@
"tagid": "130563103",
"bidfloor": 0.00123,
"banner": {
"h": 50,
"w": 320,
"format": [
{
"w": 320,
Expand Down Expand Up @@ -180,7 +178,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"]
Expand Down Expand Up @@ -326,7 +324,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"]
Expand Down Expand Up @@ -486,4 +484,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@
"tagid": "130563103",
"bidfloor": 0.00123,
"banner": {
"h": 50,
"w": 320,
"format": [
{
"w": 320,
Expand Down Expand Up @@ -152,7 +150,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"]
Expand Down Expand Up @@ -259,7 +257,7 @@
"keywords": "power tools"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"]
Expand Down Expand Up @@ -347,4 +345,4 @@
]
}
]
}
}
4 changes: 2 additions & 2 deletions adapters/smaato/smaatotest/exemplary/native.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
}
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["postbid_iframe"]
Expand Down Expand Up @@ -166,4 +166,4 @@
]
}
]
}
}
6 changes: 2 additions & 4 deletions adapters/smaato/smaatotest/exemplary/simple-banner-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@
"id": "1C86242D-9535-47D6-9576-7B1FE87F282C",
"tagid": "130563103",
"banner": {
"h": 50,
"w": 320,
"format": [
{
"w": 320,
Expand Down Expand Up @@ -160,7 +158,7 @@
"keywords": "keywords"
},
"ext": {
"client": "prebid_server_0.6"
"client": "prebid_server_0.7"
}
},
"impIDs":["1C86242D-9535-47D6-9576-7B1FE87F282C"]
Expand Down Expand Up @@ -224,4 +222,4 @@
]
}
]
}
}
Loading

0 comments on commit 7702a78

Please sign in to comment.