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

New Adapter: Intertech #3718

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

New Adapter: Intertech #3718

wants to merge 17 commits into from

Conversation

przemkaczmarek
Copy link
Collaborator

No description provided.

Copy link

github-actions bot commented Jun 3, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, b3ed88e

intertech

Refer here for heat map coverage report

total:	(statements)	0.0%

@bsardo bsardo changed the title adding new Adapter intertech New Adapter: Intertech Jun 3, 2024
@bsardo bsardo assigned bsardo and SyntaxNode and unassigned przemkaczmarek Jun 3, 2024
Copy link
Contributor

@SyntaxNode SyntaxNode left a comment

Choose a reason for hiding this comment

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

This is an excellent start. I'm excited for the first adapter ported from PBS-Java.

adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Show resolved Hide resolved
adapters/intertech/intertech.go Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
static/bidder-params/intertech.json Outdated Show resolved Hide resolved
static/bidder-info/intertech.yaml Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
@SyntaxNode
Copy link
Contributor

You also need to register the intertech name and adapter in a few other places. Please see this section in the docs or look at this other PR for an example.

Copy link

github-actions bot commented Jun 7, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, b7d5642

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:36:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:49:	MakeRequests		82.6%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:98:	getHeaders		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:115:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:122:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:129:	getIntertechPlacementId	80.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:152:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:168:	modifyImp		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:186:	modifyBanner		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:206:	resolveUrl		77.8%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:228:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:239:	getReferer		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:247:	getCurrency		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:255:	MakeBids		88.5%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:310:	getBidType		80.0%
total:									(statements)		90.8%

static/bidder-info/intertech.yaml Outdated Show resolved Hide resolved
static/bidder-info/intertech.yaml Outdated Show resolved Hide resolved
static/bidder-info/intertech.yaml Outdated Show resolved Hide resolved
openrtb_ext/imp_intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 2b1b727

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:36:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:49:	MakeRequests		82.6%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:98:	getHeaders		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:115:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:122:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:129:	getIntertechPlacementId	80.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:152:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:168:	modifyImp		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:186:	modifyBanner		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:215:	resolveUrl		77.8%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:237:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:248:	getReferer		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:256:	getCurrency		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:264:	MakeBids		92.3%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:319:	getBidType		80.0%
total:									(statements)		92.0%

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 3e2bc40

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:36:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:49:	MakeRequests		82.6%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:98:	getHeaders		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:115:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:122:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:129:	getPlacementID		87.5%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:148:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:164:	modifyImp		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:182:	modifyBanner		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:210:	resolveUrl		77.8%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:232:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:243:	getReferer		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:251:	getCurrency		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:259:	MakeBids		92.3%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:314:	getBidType		80.0%
total:									(statements)		92.6%

@bsardo bsardo self-assigned this Jul 29, 2024
@bsardo
Copy link
Collaborator

bsardo commented Nov 4, 2024

@przemkaczmarek, can you resolve conflicts? Thanks!

Copy link

github-actions bot commented Nov 5, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, f0649d6

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:36:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:49:	MakeRequests		82.6%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:98:	getHeaders		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:115:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:122:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:129:	getPlacementID		87.5%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:148:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:164:	modifyImp		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:182:	modifyBanner		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:210:	resolveUrl		77.8%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:232:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:243:	getReferer		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:251:	getCurrency		100.0%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:259:	MakeBids		92.3%
github.com/prebid/prebid-server/v2/adapters/intertech/intertech.go:314:	getBidType		80.0%
total:									(statements)		92.6%

Copy link

github-actions bot commented Nov 5, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 3dad03f

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:36:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:49:	MakeRequests		82.6%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:98:	getHeaders		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:115:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:122:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:129:	getPlacementID		87.5%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:148:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:164:	modifyImp		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:182:	modifyBanner		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:210:	resolveUrl		77.8%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:232:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:243:	getReferer		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:251:	getCurrency		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:259:	MakeBids		92.3%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:314:	getBidType		80.0%
total:									(statements)		92.6%

Copy link

github-actions bot commented Nov 5, 2024

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 6da959d

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:36:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:49:	MakeRequests		82.6%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:98:	getHeaders		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:115:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:122:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:129:	getPlacementID		87.5%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:148:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:164:	modifyImp		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:182:	modifyBanner		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:210:	resolveUrl		77.8%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:232:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:243:	getReferer		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:251:	getCurrency		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:259:	MakeBids		92.3%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:314:	getBidType		80.0%
total:									(statements)		92.6%

adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 72d3738

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:37:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:50:	MakeRequests		73.9%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:99:	getHeaders		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:116:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:123:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:130:	getPlacementID		75.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:149:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:165:	modifyImp		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:183:	modifyBanner		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:211:	resolveUrl		77.8%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:233:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:244:	getReferer		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:252:	getCurrency		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:260:	MakeBids		92.3%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:315:	getBidType		80.0%
total:									(statements)		90.4%

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 6f3c68f

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:36:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:49:	MakeRequests		73.9%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:98:	getHeaders		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:115:	addNonEmptyHeader	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:122:	splitRequestDataByImp	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:129:	getPlacementID		75.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:148:	mapExtToPlacementID	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:164:	modifyImp		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:182:	modifyBanner		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:210:	resolveUrl		77.8%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:232:	addNonEmptyQueryParams	100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:243:	getReferer		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:251:	getCurrency		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:259:	MakeBids		92.3%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:314:	getBidType		80.0%
total:									(statements)		90.4%

- native
userSync:
redirect:
url: https://prebid.intertechsrvcs.com/mapuid/intertech/?ssp-id=10500&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The Java version has &location= at the end of the URL. We'll need to figure out if that's needed.
We'll also need to verify that this redirect works. It wasn't working for me.

static/bidder-params/intertech.json Outdated Show resolved Hide resolved
adapters/intertech/params_test.go Outdated Show resolved Hide resolved
adapters/intertech/intertech_test.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
adapters/intertech/intertech.go Outdated Show resolved Hide resolved
Comment on lines 108 to 109
headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since these don't involve request.Device, I suggest moving these outside of the conditional so that they are always set.

adapters/intertech/intertech.go Outdated Show resolved Hide resolved
Comment on lines 319 to 325
if imp.Banner != nil {
return openrtb_ext.BidTypeBanner, nil
}

return "", &errortypes.BadInput{
Message: fmt.Sprintf("Processing an invalid impression; cannot resolve impression type for imp #%s", imp.ID),
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that this adapter only supports banner and native, the bid type is derived from the impression and PBS core will only call the adapter if an impression is one of the supported formats, this error case should not be possible. This function could be simplified as follows:

if imp.Native != nil {
    return openrtb_ext.BidTypeNative, nil
}
return openrtb_ext.BidTypeBanner, nil

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 80beb1c

intertech

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:32:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:39:	MakeRequests		76.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:80:	parseAndValidateImpExt	71.4%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:98:	modifyImp		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:117:	updateBanner		90.9%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:135:	modifyUrl		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:153:	buildRequestData	85.7%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:184:	getReferer		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:191:	getCur			100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:198:	MakeBids		100.0%
github.com/prebid/prebid-server/v3/adapters/intertech/intertech.go:235:	getBidType		100.0%
total:									(statements)		89.6%

Comment on lines +118 to +120
if banner == nil {
return nil, fmt.Errorf("banner is null")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can delete this conditional as banner will always be not nil since this function call is only made if banner is not nil.

Comment on lines +109 to +114
if imp.Native != nil {
return imp, nil
}
return openrtb2.Imp{}, &errortypes.BadInput{
Message: fmt.Sprintf("Intertech only supports banner and native types. Ignoring imp id=%s", imp.ID),
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can simplify this to just return imp, nil since you've only declared support for banner and native in the YAML file.

headers.Add("X-Real-Ip", bidRequest.Device.IP)
}
if bidRequest.Device.Language != "" {
headers.Add("Accept-Language", bidRequest.Device.Language)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add JSON test coverage for this line?

return &bannerCopy, nil
}

func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can delete the second return value error because it is only ever nil.

Comment on lines +90 to +92
return ExtImpIntertech{}, &errortypes.BadInput{
Message: fmt.Sprintf("imp #%s: unable to parse intertech ext: %s", imp.ID, err),
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add test coverage for these lines. You can force this error by setting page_id or imp_id to an invalid type (e.g. string) which would be something other than an integer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you move this test into the supplemental directory?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you move this test into the supplemental directory?

Comment on lines +15 to +19
"banner": {
"format": [
{ "w": 300, "h": 250 }
]
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you have simple-banner-multi-format.json which tests when format is populated, I suggest you make this test cover the case when there is no format but there are top-level dimensions:

"banner": {
    "w": 300,
    "h": 250
},

Comment on lines +3 to +14
"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",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: I suggest simplifying the names of the ids here. Just use request-id-1, imp-id-1, tag-id-1. The other names can be confusing. The test file name does a good job of indicating the test purpose.

],
"cur": ["USD"]
},
"httpCalls": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can verify the headers, specifically the device related ones, are set correctly given that you have a device object here by including the following:

"httpCalls": [
    {
      "expectedRequest": {
        "headers": {
          "Content-Type": [
            "application/json;charset=utf-8"
          ],
          "Accept": [
            "application/json"
          ],
          etc...
``

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can delete this test. Only banner and native media type requests will result in calling this adapter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest adding a new JSON test in the supplemental directory where the incoming request does not have a device object and then verify that the httpCalls[].expectedRequest.headers does not contain the device related headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants