Skip to content

Commit

Permalink
add json unit test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishshinde-pubm committed Apr 18, 2024
1 parent f4e026b commit 345ea63
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 1 deletion.
3 changes: 2 additions & 1 deletion exchange/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ func runSpec(t *testing.T, filename string, spec *exchangeSpec) {
Enabled: spec.EventsEnabled,
},
DebugAllow: true,
PriceFloors: config.AccountPriceFloors{Enabled: spec.AccountFloorsEnabled},
PriceFloors: config.AccountPriceFloors{Enabled: spec.AccountFloorsEnabled, EnforceDealFloors: spec.AccountEnforceDealFloors},
Privacy: spec.AccountPrivacy,
Validations: spec.AccountConfigBidValidation,
},
Expand Down Expand Up @@ -5493,6 +5493,7 @@ type exchangeSpec struct {
HostConfigBidValidation config.Validations `json:"host_bid_validations"`
AccountConfigBidValidation config.Validations `json:"account_bid_validations"`
AccountFloorsEnabled bool `json:"account_floors_enabled"`
AccountEnforceDealFloors bool `json:"account_enforce_deal_floors"`
FledgeEnabled bool `json:"fledge_enabled,omitempty"`
MultiBid *multiBidSpec `json:"multiBid,omitempty"`
Server exchangeServer `json:"server,omitempty"`
Expand Down
147 changes: 147 additions & 0 deletions exchange/exchangetest/floors_deal_enforcement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"floors_enabled": true,
"account_floors_enabled": true,
"account_enforce_deal_floors": true,
"incomingRequest": {
"ortbRequest": {
"id": "request-id",
"site": {
"page": "test.somepage.com"
},
"imp": [
{
"id": "imp-id",
"video": {
"mimes": [
"video/mp4"
]
},
"bidfloor": 20,
"bidfloorcur": "USD",
"ext": {
"prebid": {
"bidder": {
"appnexus": {
"placementId": 1
},
"pubmatic": {
"publisherId": "1234"
}
}
}
}
}
],
"ext": {
"prebid": {
"floors": {
"enabled": true,
"enforcement": {
"floordeals": true,
"enforcerate": 100
}
}
}
}
}
},
"outgoingRequests": {
"appnexus": {
"mockResponse": {
"pbsSeatBids": [
{
"pbsBids": [
{
"ortbBid": {
"id": "apnx-bid-id",
"dealid": "apnx-deal-id",
"impid": "imp-id",
"price": 5,
"w": 200,
"h": 250,
"crid": "creative-1"
}
}
],
"seat": "appnexus",
"currency": "USD"
}
]
}
},
"pubmatic": {
"mockResponse": {
"pbsSeatBids": [
{
"pbsBids": [
{
"ortbBid": {
"id": "pubm-bid-id",
"impid": "imp-id",
"price": 10,
"w": 200,
"h": 250,
"crid": "creative-1"
}
}
],
"seat": "pubmatic",
"currency": "USD"
}
]
}
}
},
"response": {
"bids": {},
"ext": {
"prebid": {
"seatnonbid": [
{
"nonbid": [
{
"impid": "imp-id",
"statuscode": 304,
"ext": {
"prebid": {
"bid": {
"price": 5,
"w": 200,
"h": 250,
"crid": "creative-1",
"origbidcpm": 5,
"dealid": "apnx-deal-id"
}
}
}
}
],
"seat": "appnexus",
"ext": null
},
{
"nonbid": [
{
"impid": "imp-id",
"statuscode": 301,
"ext": {
"prebid": {
"bid": {
"price": 10,
"w": 200,
"h": 250,
"crid": "creative-1",
"origbidcpm": 10
}
}
}
}
],
"seat": "pubmatic",
"ext": null
}
]
}
}
}
}

0 comments on commit 345ea63

Please sign in to comment.