Skip to content

Commit

Permalink
Revert "Update adapter json test framework to validate BidVideo (preb…
Browse files Browse the repository at this point in the history
…id#3835)"

This reverts commit 6fd8d18.
  • Loading branch information
krdzo authored Oct 30, 2024
1 parent b74653b commit a91bf3c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
19 changes: 3 additions & 16 deletions adapters/adapterstest/test_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,9 @@ type expectedBidResponse struct {
}

type expectedBid struct {
Bid json.RawMessage `json:"bid"`
Type string `json:"type"`
Seat string `json:"seat"`
Video json.RawMessage `json:"video,omitempty"`
Bid json.RawMessage `json:"bid"`
Type string `json:"type"`
Seat string `json:"seat"`
}

// ---------------------------------------
Expand Down Expand Up @@ -343,9 +342,6 @@ func diffBids(t *testing.T, description string, actual *adapters.TypedBid, expec
assert.Equal(t, string(expected.Seat), string(actual.Seat), fmt.Sprintf(`%s.seat "%s" does not match expected "%s."`, description, string(actual.Seat), string(expected.Seat)))
assert.Equal(t, string(expected.Type), string(actual.BidType), fmt.Sprintf(`%s.type "%s" does not match expected "%s."`, description, string(actual.BidType), string(expected.Type)))
assert.NoError(t, diffOrtbBids(fmt.Sprintf("%s.bid", description), actual.Bid, expected.Bid))
if expected.Video != nil {
assert.NoError(t, diffBidVideo(fmt.Sprintf("%s.video", description), actual.BidVideo, expected.Video))
}
}

// diffOrtbBids compares the actual Bid made by the adapter to the expectation from the JSON file.
Expand All @@ -362,15 +358,6 @@ func diffOrtbBids(description string, actual *openrtb2.Bid, expected json.RawMes
return diffJson(description, actualJson, expected)
}

func diffBidVideo(description string, actual *openrtb_ext.ExtBidPrebidVideo, expected json.RawMessage) error {
actualJson, err := json.Marshal(actual)
if err != nil {
return fmt.Errorf("%s failed to marshal actual Bid Video into JSON. %v", description, err)
}

return diffJson(description, actualJson, []byte(expected))
}

// diffJson compares two JSON byte arrays for structural equality. It will produce an error if either
// byte array is not actually JSON.
func diffJson(description string, actual []byte, expected []byte) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@
},
"type": "video",
"video" : {
"duration" : 10,
"primary_category": ""
"duration" : 10
}
}
]
Expand Down
3 changes: 1 addition & 2 deletions adapters/pubmatic/pubmatictest/exemplary/video.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@
},
"type": "video",
"video" :{
"duration" : 5,
"primary_category": ""
"duration" : 5
}
}
]
Expand Down
3 changes: 1 addition & 2 deletions adapters/yeahmobi/yeahmobitest/exemplary/simple-video.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@
},
"type": "video",
"video": {
"duration": 300,
"primary_category": ""
"duration": 300
}
}
]
Expand Down

0 comments on commit a91bf3c

Please sign in to comment.