Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
przemkaczmarek committed Dec 11, 2024
1 parent 4745c28 commit 80beb1c
Show file tree
Hide file tree
Showing 20 changed files with 755 additions and 1,271 deletions.
11 changes: 0 additions & 11 deletions adapters/intertech/intertech.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,6 @@ func parseAndValidateImpExt(imp openrtb2.Imp) (ExtImpIntertech, error) {
}
}

if extImp.PageID == 0 {
return ExtImpIntertech{}, &errortypes.BadInput{
Message: fmt.Sprintf("imp #%s: missing param page_id", imp.ID),
}
}
if extImp.ImpID == 0 {
return ExtImpIntertech{}, &errortypes.BadInput{
Message: fmt.Sprintf("imp #%s: missing param imp_id", imp.ID),
}
}

return extImp, nil
}

Expand Down
71 changes: 71 additions & 0 deletions adapters/intertech/intertechtest/exemplary/no-cur-req.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"mockBidRequest": {
"id": "test-no-cur-request-id",
"device": {
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (X11; Linux x86_64)"
},
"site": {
"page": "http://example-nocur.com"
},
"imp": [
{
"id": "test-imp-no-cur",
"tagid": "no-cur-tag",
"banner": {
"format": [
{ "w": 300, "h": 250 }
]
},
"ext": {
"bidder": {
"page_id": 1111,
"imp_id": 2222
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.intertech.com/ssp?pid=1111&imp=2222&target-ref=http%3A%2F%2Fexample-nocur.com",
"body": {
"id": "test-no-cur-request-id",
"imp": [
{
"id": "test-imp-no-cur",
"tagid": "no-cur-tag",
"banner": {
"w": 300,
"h": 250,
"format": [
{ "w": 300, "h": 250 }
]
},
"ext": {
"bidder": {
"page_id": 1111,
"imp_id": 2222
}
}
}
],
"site": {
"page": "http://example-nocur.com"
},
"device": {
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (X11; Linux x86_64)"
}
},
"impIDs": ["test-imp-no-cur"]
},
"mockResponse": {
"status": 204,
"body": {}
}
}
],
"expectedBidResponses": []
}
67 changes: 67 additions & 0 deletions adapters/intertech/intertechtest/exemplary/no-site-req.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"mockBidRequest": {
"id": "test-no-site-request-id",
"device": {
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (X11; Linux x86_64)"
},
"imp": [
{
"id": "test-imp-no-site",
"tagid": "no-site-tag",
"banner": {
"format": [
{ "w": 300, "h": 250 }
]
},
"ext": {
"bidder": {
"page_id": 3003,
"imp_id": 5005
}
}
}
],
"cur": ["USD"]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.intertech.com/ssp?pid=3003&imp=5005&ssp-cur=USD",
"body": {
"id": "test-no-site-request-id",
"imp": [
{
"id": "test-imp-no-site",
"tagid": "no-site-tag",
"banner": {
"w": 300,
"h": 250,
"format": [
{ "w": 300, "h": 250 }
]
},
"ext": {
"bidder": {
"page_id": 3003,
"imp_id": 5005
}
}
}
],
"device": {
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (X11; Linux x86_64)"
},
"cur": ["USD"]
},
"impIDs": ["test-imp-no-site"]
},
"mockResponse": {
"status": 204,
"body": {}
}
}
],
"expectedBidResponses": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"mockBidRequest": {
"id": "test-missing-dimensions-request-id",
"device": {
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (X11; Linux x86_64)"
},
"site": {
"page": "http://bannercheck.com"
},
"imp": [
{
"id": "test-imp-missing-dim",
"tagid": "tag-missing-dim",
"banner": {
"format": [
{ "w": 728, "h": 90 },
{ "w": 300, "h": 250 }
]
},
"ext": {
"bidder": {
"page_id": 1111,
"imp_id": 2222
}
}
}
],
"cur": ["USD"]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.intertech.com/ssp?pid=1111&imp=2222&target-ref=http%3A%2F%2Fbannercheck.com&ssp-cur=USD",
"body": {
"id": "test-missing-dimensions-request-id",
"imp": [
{
"id": "test-imp-missing-dim",
"tagid": "tag-missing-dim",
"banner": {
"w": 728,
"h": 90,
"format": [
{ "w": 728, "h": 90 },
{ "w": 300, "h": 250 }
]
},
"ext": {
"bidder": {
"page_id": 1111,
"imp_id": 2222
}
}
}
],
"site": {
"page": "http://bannercheck.com"
},
"device": {
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (X11; Linux x86_64)"
},
"cur": ["USD"]
},
"impIDs": ["test-imp-missing-dim"]
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-missing-dimensions-request-id",
"cur": "USD",
"seatbid": [
{
"seat": "intertech",
"bid": [
{
"id": "test_bid_missing_dim",
"impid": "test-imp-missing-dim",
"price": 0.7,
"adm": "<html><body><h1>Test Banner 728x90</h1></body></html>",
"cid": "cid_missing_dim",
"crid": "crid_missing_dim",
"w": 728,
"h": 90,
"mtype": 1
}
]
}
]
}
}
}
],
"expectedBidResponses": [
{
"bids": [
{
"bid": {
"id": "test_bid_missing_dim",
"impid": "test-imp-missing-dim",
"price": 0.7,
"adm": "<html><body><h1>Test Banner 728x90</h1></body></html>",
"cid": "cid_missing_dim",
"crid": "crid_missing_dim",
"w": 728,
"h": 90,
"mtype": 1
},
"type": "banner"
}
]
}
]
}
Loading

0 comments on commit 80beb1c

Please sign in to comment.