Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdbreakId support for smaato bidder #986

Open
wants to merge 3 commits into
base: ci
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/pubmatic/openwrap/adapters/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ func builderSmaato(params BidderParameters) (json.RawMessage, error) {
fmt.Fprintf(&jsonStr, `"adspaceId":"%s"`, adspaceID)
}

if adbreakID, ok := getString(params.FieldMap["adbreakId"]); ok {
fmt.Fprintf(&jsonStr, `,"adbreakId":"%s"`, adbreakID)
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pubmatic-Supriya-Patil : Have we checked on impact if both adbreakid and adspaceid are passed on to Smaato adapter in adapter code? Whether both are passed to bidder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed , only one field will be used based on type of request.

jsonStr.WriteByte('}')
return jsonStr.Bytes(), nil
}
Expand Down
62 changes: 61 additions & 1 deletion modules/pubmatic/openwrap/adapters/bidders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2045,7 +2045,7 @@ func TestPrepareBidParamJSONForPartnerSmaato(t *testing.T) {
want: nil,
},
{
name: "All params are present",
name: "publisherId_adspaceId_both_are_present",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pubmatic-Supriya-Patil : What is the change in this test case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously all params means publisher Id and adspace Id. now we added adbreakId as new field so just renamed test case name accordingly.

args: args{

width: nil,
Expand All @@ -2060,6 +2060,66 @@ func TestPrepareBidParamJSONForPartnerSmaato(t *testing.T) {
},
want: json.RawMessage(`{"publisherId": "1234","adspaceId": "3456"}`),
},
{
name: "All_params_are_present",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pubmatic-Supriya-Patil : why have we introduced new test case. The test case with this name was present before, as per last review comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new test case is for publisherId, adspaceId and adbreakId. Previous one was only for publisherId and adspaceId

args: args{
width: nil,
height: nil,
fieldMap: map[string]interface{}{
"publisherId": "1234",
"adspaceId": "3456",
"adbreakId": "7899",
},
slotKey: "",
adapterName: string(openrtb_ext.BidderSmaato),
bidderCode: string(openrtb_ext.BidderSmaato),
},
want: json.RawMessage(`{"publisherId": "1234","adspaceId": "3456","adbreakId": "7899"}`),
},
{
name: "publisherId_and_adbreakId_present",
args: args{
width: nil,
height: nil,
fieldMap: map[string]interface{}{
"publisherId": "1234",
"adbreakId": "7899",
},
slotKey: "",
adapterName: string(openrtb_ext.BidderSmaato),
bidderCode: string(openrtb_ext.BidderSmaato),
},
want: nil,
},
{
name: "adspaceId_and_adbreakId_present",
args: args{
width: nil,
height: nil,
fieldMap: map[string]interface{}{
"adspaceId": "1234",
"adbreakId": "7899",
},
slotKey: "",
adapterName: string(openrtb_ext.BidderSmaato),
bidderCode: string(openrtb_ext.BidderSmaato),
},
want: nil,
},
{
name: "adbreakId_present",
args: args{
width: nil,
height: nil,
fieldMap: map[string]interface{}{
"adbreakId": "7899",
},
slotKey: "",
adapterName: string(openrtb_ext.BidderSmaato),
bidderCode: string(openrtb_ext.BidderSmaato),
},
want: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
Loading