Skip to content

Commit

Permalink
Add mediaType adn vastUrl for video reponse
Browse files Browse the repository at this point in the history
  • Loading branch information
Fang Bai committed Nov 10, 2017
1 parent 630b68e commit f17206f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
7 changes: 2 additions & 5 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,9 @@ function createVideoBidResponses(response, {bid, startTime}) {
bidResponse.width = response.width;
bidResponse.height = response.height;
bidResponse.creativeId = response.adid;
bidResponse.vastUrl = response.vastUrl;
bidResponse.mediaType = VIDEO;

bidResponse.openx = {
ff: response.cache_key,
oxcolo: response.per_colo_domain,
oxph: response.ph
};
bidResponses.push(bidResponse);
}

Expand Down
28 changes: 10 additions & 18 deletions test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { newBidder } from 'src/adapters/bidderFactory';
const URLBASE = '/w/1.0/arj';
const URLBASEVIDEO = '/v/1.0/avjp';

describe.only('OpenxAdapter', () => {
describe('OpenxAdapter', () => {
const adapter = newBidder(spec);

describe('inherited functions', () => {
Expand Down Expand Up @@ -169,9 +169,7 @@ describe.only('OpenxAdapter', () => {
'unit': '12345678',
'delDomain': 'test-del-domain',
'video': {
'be': 'true',
'url': 'abc.com',
'vtest': '1'
}
},
'adUnitCode': 'adunit-code',
Expand All @@ -196,8 +194,6 @@ describe.only('OpenxAdapter', () => {
expect(dataParams.auid).to.equal('12345678');
expect(dataParams.url).to.exist;
expect(dataParams.url).to.equal('abc.com');
expect(dataParams.vtest).to.exist;
expect(dataParams.vtest).to.equal('1');
});
});

Expand Down Expand Up @@ -301,9 +297,7 @@ describe.only('OpenxAdapter', () => {
'unit': '12345678',
'delDomain': 'test-del-domain',
'video': {
'be': 'true',
'url': 'abc.com',
'vtest': '1'
}
},
'adUnitCode': 'adunit-code',
Expand All @@ -320,11 +314,12 @@ describe.only('OpenxAdapter', () => {
payload: {'bid': bids[0], 'startTime': new Date()}
};
let bidResponse = {
'cache_key': 'test_cache_key',
'pub_rev': '1',
'per_colo_domain': 'http://delivery-us-west-1.openx.net',
'ph': '7a3b9374-7986-4a41-a79d-034193518aee',
'adid': 5678,
'width': '640',
'height': '480',
'adid': '5678',
'vastUrl': 'http://testvast.com',
'pixels': 'http://testpixels.net'
};

it('should return correct bid response', () => {
Expand All @@ -335,12 +330,9 @@ describe.only('OpenxAdapter', () => {
'cpm': 1,
'width': '640',
'height': '480',
'creativeId': 5678,
'openx': {
'ff': 'test_cache_key',
'oxcolo': 'http://delivery-us-west-1.openx.net',
'oxph': '7a3b9374-7986-4a41-a79d-034193518aee'
},
'mediaType': 'video',
'creativeId': '5678',
'vastUrl': 'http://testvast.com',
'ttl': 300,
'netRevenue': true,
'currency': 'USD'
Expand All @@ -352,7 +344,7 @@ describe.only('OpenxAdapter', () => {
});

it('handles nobid responses', () => {
let bidResponse = {'cache_key': '', 'pub_rev': '', 'per_colo_domain': '', 'ph': ''};
let bidResponse = {'vastUrl': '', 'pub_rev': '', 'width': '', 'height': '', 'adid': '', 'pixels': ''};
let result = spec.interpretResponse({body: bidResponse}, bidRequest);
expect(result.length).to.equal(0);
});
Expand Down

0 comments on commit f17206f

Please sign in to comment.