Skip to content

Commit

Permalink
feat: add multiple imp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tradplus committed Jan 24, 2025
1 parent 577edec commit 5d96259
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 2 deletions.
3 changes: 1 addition & 2 deletions adapters/tradplus/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestInvalidParams(t *testing.T) {

var validParams = []string{
`{"accountId": "11233", "zoneId": ""}`,
`{"accountId": "aaa", "accountId": "us"}`,
`{"accountId": "aaa", "zoneId": "us"}`,
`{"accountId": "aa", "accountId": "sin"}`,
}

Expand All @@ -49,6 +49,5 @@ var invalidParams = []string{
`{"accountId": true}`,
`{"accountId": null}`,
`{"zoneId": "aaa"}`,
`{"zoneId": "aaa"}`,
`{"zoneId": null}`,
}
128 changes: 128 additions & 0 deletions adapters/tradplus/tradplustest/exemplary/simple-banner-multi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 50
}
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id",
"zoneId": "a"
}
}
},
{
"id": "test-imp-id2",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id2",
"zoneId": "b"
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://aadx.tradplusad.com/fake-account-id/pserver",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 50
}
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id",
"zoneId": "a"
}
}
},
{
"id": "test-imp-id2",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id2",
"zoneId": "b"
}
}
}
]
},
"impIDs":["test-imp-id", "test-imp-id2"]
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "ttx",
"bid": [
{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 1.2,
"adm": "some-ads",
"crid": "crid_testid",
"mtype": 1
}
]
}
],
"cur": "USD"
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 1.2,
"adm": "some-ads",
"crid": "crid_testid",
"mtype": 1
},
"type": "banner"
}
]
}
]
}
126 changes: 126 additions & 0 deletions adapters/tradplus/tradplustest/exemplary/simple-multi-types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id",
"zoneId": "a"
}
}
},
{
"id": "test-imp-id2",
"video": {
"w": 320,
"h": 480,
"mimes": [
"video/mp4"
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id2",
"zoneId": ""
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://aadx.tradplusad.com/fake-account-id/pserver",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id",
"zoneId": "a"
}
}
},
{
"id": "test-imp-id2",
"video": {
"w": 320,
"h": 480,
"mimes": [
"video/mp4"
]
},
"ext": {
"bidder": {
"accountId": "fake-account-id2",
"zoneId": ""
}
}
}
]
},
"impIDs":["test-imp-id", "test-imp-id2"]
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "ttx",
"bid": [
{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 1.2,
"adm": "some-ads",
"crid": "crid_testid",
"mtype": 1
}
]
}
],
"cur": "USD"
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 1.2,
"adm": "some-ads",
"crid": "crid_testid",
"mtype": 1
},
"type": "banner"
}
]
}
]
}

0 comments on commit 5d96259

Please sign in to comment.