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

use unit id being sent instead of hard coded auid #3236

Merged
merged 3 commits into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions modules/openxoutstreamBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: SUPPORTED_AD_TYPES,
isBidRequestValid: function(bidRequest) {
if (bidRequest.params.delDomain) {
return !!bidRequest.params.unit || utils.deepAccess(bidRequest, 'mediaTypes.banner.sizes.length') > 0;
}
return false;
return !!(bidRequest.params.delDomain && bidRequest.params.unit)
},
buildRequests: function(bidRequests, bidderRequest) {
if (bidRequests.length === 0) {
Expand All @@ -36,12 +33,6 @@ export const spec = {
interpretResponse: function(serverResponse, serverRequest) {
return handleVastResponse(serverResponse, serverRequest.payload)
},

transformBidParams: function(params, isOpenRtb) {
return utils.convertTypes({
'unit': 'string',
}, params);
}
};

function getViewportDimensions(isIfr) {
Expand Down Expand Up @@ -83,7 +74,7 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
tws: getViewportDimensions(isInIframe),
be: 1,
bc: bids[0].params.bc || `${BIDDER_CONFIG}_${BIDDER_VERSION}`,
auid: '540141567',
auid: bids[0].params.unit,
HolzAndrew marked this conversation as resolved.
Show resolved Hide resolved
dddid: utils._map(bids, bid => bid.transactionId).join(','),
openrtb: '%7B%22mimes%22%3A%5B%22video%2Fmp4%22%5D%7D',
nocache: new Date().getTime(),
Expand Down
3 changes: 1 addition & 2 deletions modules/openxoutstreamBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ var adUnits = [
{
bidder: 'openxoutstream',
params: {
unit: '53943996499',
unit: '540141567',
delDomain: 'se-demo-d.openx.net',
publisher_page_url: 'yieldmo.com',
width: '300',
height: '250',
}
Expand Down
50 changes: 25 additions & 25 deletions test/spec/modules/openxoutstreamBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,23 @@ describe('OpenXOutstreamAdapter', function () {
bannerBid.params = {delDomain: 'test-delivery-domain'}
});

it('should return false when there is no ad unit id and size', function () {
it('should return false if there is no adunit id and sizes are defined', function () {
bannerBid.mediaTypes.banner.sizes = [720, 90];
expect(spec.isBidRequestValid(bannerBid)).to.equal(false);
});

it('should return true if there is an adunit id ', function () {
it('should return true if there is delivery domain and unit', function () {
bannerBid.params.unit = '12345678';
expect(spec.isBidRequestValid(bannerBid)).to.equal(true);
});

it('should return true if there is no adunit id and sizes are defined', function () {
bannerBid.mediaTypes.banner.sizes = [720, 90];
expect(spec.isBidRequestValid(bannerBid)).to.equal(true);
});

it('should return false if no sizes are defined ', function () {
it('should return false if there is unit but no delivery domain', function () {
bannerBid.params = {unit: '12345678'};
expect(spec.isBidRequestValid(bannerBid)).to.equal(false);
});

it('should return false if sizes empty ', function () {
bannerBid.mediaTypes.banner.sizes = [];
it('shoud return false if there is no delivery domain and no unit', function () {
bannerBid.params = {};
expect(spec.isBidRequestValid(bannerBid)).to.equal(false);
});
})
});
});
});
Expand All @@ -92,40 +87,45 @@ describe('OpenXOutstreamAdapter', function () {
expect(request[0].method).to.equal('GET');
});

it('should send ad unit ids when any are defined', function () {
it('should send ad unit ids, height, and width when any are defined', function () {
const bidRequestsWithUnitIds = [{
'bidder': BIDDER,
'params': {
'unit': '540141567',
'height': '300',
'width': '250',
'delDomain': 'test-del-domain'
},
'adUnitCode': 'adunit-code',
'sizes': [300, 250],
sizes: [300, 250],
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]]
sizes: [[728, 90]]
}
},
'bidId': 'test-bid-id-1',
'bidderRequestId': 'test-bid-request-1',
'auctionId': 'test-auction-1'
'bidId': 'test-bid-id-2',
'bidderRequestId': 'test-bid-request-2',
'auctionId': 'test-auction-2'
}, {
'bidder': BIDDER,
'params': {
'unit': '540141567',
'delDomain': 'test-del-domain'
},
'adUnitCode': 'adunit-code',
'sizes': [300, 250],
mediaTypes: {
banner: {
sizes: [[728, 90]]
sizes: [[300, 250], [300, 600]]
}
},
'bidId': 'test-bid-id-2',
'bidderRequestId': 'test-bid-request-2',
'auctionId': 'test-auction-2'
'bidId': 'test-bid-id-1',
'bidderRequestId': 'test-bid-request-1',
'auctionId': 'test-auction-1'
}];
const request = spec.buildRequests(bidRequestsWithUnitIds);
expect(request[0].data.auid).to.equal(`${bidRequestsWithUnitIds[1].params.unit}`);
expect(request[0].data.auid).to.equal(`${bidRequestsWithUnitIds[0].params.unit}`);
expect(request[0].data.vht).to.equal(`${bidRequestsWithUnitIds[0].params.height}`);
expect(request[0].data.vwd).to.equal(`${bidRequestsWithUnitIds[0].params.width}`);
});

describe('interpretResponse', function () {
Expand Down