Skip to content

Commit

Permalink
Rename appnexusAst adapter to appnexus adapter (#1848)
Browse files Browse the repository at this point in the history
* Renamed appnexusAst adapter to appnexus

* Updated unit test to use appnexus bidderCode

* Remove completed todo comment
  • Loading branch information
jaiminpanchal27 authored and Matt Kendall committed Nov 20, 2017
1 parent a413944 commit 28d0703
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as utils from 'src/utils';
import { registerBidder } from 'src/adapters/bidderFactory';
import { NATIVE, VIDEO } from 'src/mediaTypes';

const BIDDER_CODE = 'appnexusAst';
const BIDDER_CODE = 'appnexus';
const URL = '//ib.adnxs.com/ut/v3/prebid';
const SUPPORTED_AD_TYPES = ['banner', 'video', 'native'];
const VIDEO_TARGETING = ['id', 'mimes', 'minduration', 'maxduration',
Expand All @@ -28,7 +28,7 @@ const SOURCE = 'pbjs';

export const spec = {
code: BIDDER_CODE,
aliases: ['brealtime', 'pagescience', 'defymedia', 'gourmetads', 'matomy', 'featureforward', 'oftmedia'],
aliases: ['appnexusAst', 'brealtime', 'pagescience', 'defymedia', 'gourmetads', 'matomy', 'featureforward', 'oftmedia'],
supportedMediaTypes: [VIDEO, NATIVE],

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Overview

```
Module Name: AppnexusAst Bid Adapter
Module Name: Appnexus Bid Adapter
Module Type: Bidder Adapter
Maintainer: info@prebid.org
```
Expand All @@ -10,7 +10,7 @@ Maintainer: info@prebid.org

Connects to Appnexus exchange for bids.

AppnexusAst bid adapter supports Banner, Video (instream and outstream) and Native.
Appnexus bid adapter supports Banner, Video (instream and outstream) and Native.

# Test Parameters
```
Expand All @@ -20,7 +20,7 @@ var adUnits = [
code: 'banner-div',
sizes: [[300, 250], [300,600]],
bids: [{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '10433394'
}
Expand Down Expand Up @@ -51,7 +51,7 @@ var adUnits = [
}
},
bids: [{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '9880618'
}
Expand All @@ -67,7 +67,7 @@ var adUnits = [
},
},
bids: [{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '9333431',
video: {
Expand All @@ -88,7 +88,7 @@ var adUnits = [
},
bids: [
{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '5768085',
video: {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/video/adUnit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"mediaType": "video",
"bids": [
{
"bidder": "appnexusAst",
"bidder": "appnexus",
"params": {
"placementId": "9333431",
"video": {
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/video/bidRequest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"auctionStart": 1462918897459,
"bidderCode": "appnexusAst",
"bidderCode": "appnexus",
"bidderRequestId": "2946b569352ef2",
"bids": [
{
"bidder": "appnexusAst",
"bidder": "appnexus",
"params": {
"placementId": "9333431",
"video": {
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/video/vastPayloadResponse.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"adUnitCode": "video1",
"bidder": "appnexusAst",
"bidderCode": "appnexusAst",
"code": "appnexusAst",
"bidder": "appnexus",
"bidderCode": "appnexus",
"code": "appnexus",
"dealId": "foo",
"cpm": 0.1,
"height": 480,
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/video/vastUrlResponse.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"adUnitCode": "video1",
"bidder": "appnexusAst",
"bidderCode": "appnexusAst",
"code": "appnexusAst",
"bidder": "appnexus",
"bidderCode": "appnexus",
"code": "appnexus",
"dealId": "foo",
"cpm": 0.1,
"height": 480,
Expand Down
2 changes: 1 addition & 1 deletion test/pages/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
bids: [
{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '9333431',
video: {
Expand Down
4 changes: 2 additions & 2 deletions test/spec/e2e/gpt-examples/gpt_outstream.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
mediaType: 'video-outstream',
bids: [
{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '5768085',
video: {
Expand All @@ -62,7 +62,7 @@
mediaType: 'video-outstream',
bids: [
{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '5768085',
video: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { spec } from 'modules/appnexusAstBidAdapter';
import { spec } from 'modules/appnexusBidAdapter';
import { newBidder } from 'src/adapters/bidderFactory';

const ENDPOINT = '//ib.adnxs.com/ut/v3/prebid';
Expand All @@ -15,7 +15,7 @@ describe('AppNexusAdapter', () => {

describe('isBidRequestValid', () => {
let bid = {
'bidder': 'appnexusAst',
'bidder': 'appnexus',
'params': {
'placementId': '10433394'
},
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('AppNexusAdapter', () => {
describe('buildRequests', () => {
let bidRequests = [
{
'bidder': 'appnexusAst',
'bidder': 'appnexus',
'params': {
'placementId': '10433394'
},
Expand Down
4 changes: 2 additions & 2 deletions test/spec/unit/core/adapterManager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('adapterManager tests', () => {
'tid': '34566b569352ef2',
'bids': [
{
'bidder': 'appnexusAst',
'bidder': 'appnexus',
'params': {
'placementId': '4799418',
'test': 'me'
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('adapterManager tests', () => {
const adUnits = [{
code: 'adUnit-code',
bids: [
{bidder: 'appnexusAst', params: {placementId: 'id'}},
{bidder: 'appnexus', params: {placementId: 'id'}},
{bidder: 'fakeBidder', params: {placementId: 'id'}}
]
}];
Expand Down
43 changes: 26 additions & 17 deletions test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { targeting, newTargeting } from 'src/targeting';
import { config as configObj } from 'src/config';
import * as ajaxLib from 'src/ajax';
import * as auctionModule from 'src/auction';
import { registerBidder } from 'src/adapters/bidderFactory';

var assert = require('chai').assert;
var expect = require('chai').expect;
Expand All @@ -29,7 +30,7 @@ var adserver = require('src/adserver');
var CONSTANTS = require('src/constants.json');

// These bid adapters are required to be loaded for the following tests to work
require('modules/appnexusAstBidAdapter');
require('modules/appnexusBidAdapter');

var config = require('test/fixtures/config.json');

Expand Down Expand Up @@ -410,12 +411,12 @@ describe('Unit: Prebid Module', function () {
currentPriceBucket = configObj.getConfig('priceGranularity');
configObj.setConfig({ priceGranularity: customConfigObject });
sinon.stub(adaptermanager, 'makeBidRequests', () => ([{
'bidderCode': 'appnexusAst',
'bidderCode': 'appnexus',
'auctionId': '20882439e3238c',
'bidderRequestId': '331f3cf3f1d9c8',
'bids': [
{
'bidder': 'appnexusAst',
'bidder': 'appnexus',
'params': {
'placementId': '10433394'
},
Expand Down Expand Up @@ -451,7 +452,7 @@ describe('Unit: Prebid Module', function () {
code: 'div-gpt-ad-1460505748561-0',
sizes: [[300, 250], [300, 600]],
bids: [{
bidder: 'appnexusAst',
bidder: 'appnexus',
params: {
placementId: '10433394'
}
Expand Down Expand Up @@ -818,6 +819,15 @@ describe('Unit: Prebid Module', function () {
var auctionManagerStub;
let logMessageSpy

let spec = {
code: 'sampleBidder',
isBidRequestValid: () => {},
buildRequests: () => {},
interpretResponse: () => {},
getUserSyncs: () => {}
};
registerBidder(spec);

describe('part 1', () => {
beforeEach(() => {
adUnitsBackup = auction.getAdUnits
Expand Down Expand Up @@ -901,15 +911,15 @@ describe('Unit: Prebid Module', function () {
sizes: [[300, 250], [300, 600]],
bids: [
{bidder: 'appnexus', params: {placementId: 'id'}},
{bidder: 'appnexusAst', params: {placementId: 'id'}}
{bidder: 'sampleBidder', params: {placementId: 'id'}}
]
}];
adUnitCodes = ['adUnit-code'];
let auction = auctionModule.newAuction({adUnits, adUnitCodes, callback: function() {}, cbTimeout: timeout});
spyCallBids = sinon.spy(adaptermanager, 'callBids');
createAuctionStub = sinon.stub(auctionModule, 'newAuction');
createAuctionStub.returns(auction);
})
});

after(() => {
auctionModule.newAuction.restore();
Expand All @@ -918,7 +928,7 @@ describe('Unit: Prebid Module', function () {

it('should not callBids if a video adUnit has non-video bidders', () => {
const videoAdaptersBackup = adaptermanager.videoAdapters;
adaptermanager.videoAdapters = ['appnexusAst'];
adaptermanager.videoAdapters = ['appnexus'];
$$PREBID_GLOBAL$$.requestBids({adUnits});
sinon.assert.notCalled(adaptermanager.callBids);
adaptermanager.videoAdapters = videoAdaptersBackup;
Expand All @@ -936,7 +946,7 @@ describe('Unit: Prebid Module', function () {
mediaType: 'video',
sizes: [[300, 250], [300, 600]],
bids: [
{bidder: 'appnexusAst', params: {placementId: 'id'}}
{bidder: 'appnexus', params: {placementId: 'id'}}
]
}];
adUnitCodes = ['adUnit-code'];
Expand All @@ -953,7 +963,7 @@ describe('Unit: Prebid Module', function () {

it('should callBids if a video adUnit has all video bidders', () => {
const videoAdaptersBackup = adaptermanager.videoAdapters;
adaptermanager.videoAdapters = ['appnexusAst'];
adaptermanager.videoAdapters = ['appnexus'];
$$PREBID_GLOBAL$$.requestBids({adUnits});
sinon.assert.calledOnce(adaptermanager.callBids);
adaptermanager.videoAdapters = videoAdaptersBackup;
Expand All @@ -972,23 +982,23 @@ describe('Unit: Prebid Module', function () {
sizes: [[300, 250], [300, 600]],
bids: [
{bidder: 'appnexus', params: {placementId: 'id'}},
{bidder: 'appnexusAst', params: {placementId: 'id'}}
{bidder: 'sampleBidder', params: {placementId: 'id'}}
]
}];
adUnitCodes = ['adUnit-code'];
let auction = auctionModule.newAuction({adUnits, adUnitCodes, callback: function() {}, cbTimeout: timeout});
spyCallBids = sinon.spy(adaptermanager, 'callBids');
createAuctionStub = sinon.stub(auctionModule, 'newAuction');
createAuctionStub.returns(auction);
})
});

after(() => {
auctionModule.newAuction.restore();
adaptermanager.callBids.restore();
});

it('should only request native bidders on native adunits', () => {
// appnexusAst is a native bidder, appnexus is not
// appnexus is a native bidder, appnexus is not
$$PREBID_GLOBAL$$.requestBids({adUnits});
sinon.assert.calledOnce(adaptermanager.callBids);
const spyArgs = adaptermanager.callBids.getCall(0);
Expand All @@ -1007,7 +1017,7 @@ describe('Unit: Prebid Module', function () {
code: 'adUnit-code',
sizes: [[300, 250], [300, 600]],
bids: [
{bidder: 'appnexusAst', params: {placementId: '10433394'}}
{bidder: 'appnexus', params: {placementId: '10433394'}}
]
}];
let adUnitCodes = ['adUnit-code'];
Expand All @@ -1022,7 +1032,7 @@ describe('Unit: Prebid Module', function () {
nativeParams: {type: 'image'},
sizes: [[300, 250], [300, 600]],
bids: [
{bidder: 'appnexusAst', params: {placementId: 'id'}}
{bidder: 'appnexus', params: {placementId: 'id'}}
]
}];
let auction3 = auctionModule.newAuction({adUnits, adUnitCodes, callback: function() {}, cbTimeout: timeout});
Expand All @@ -1046,7 +1056,6 @@ describe('Unit: Prebid Module', function () {
})

it('should callBids if a native adUnit has all native bidders', () => {
// TODO: appnexusAst is currently hardcoded in native.js, update this text when fixed
$$PREBID_GLOBAL$$.requestBids({adUnits});
sinon.assert.calledOnce(adaptermanager.callBids);
});
Expand All @@ -1056,7 +1065,7 @@ describe('Unit: Prebid Module', function () {
code: 'adUnit-code',
sizes: [[300, 250], [300, 600]],
bids: [
{bidder: 'appnexusAst', params: {placementId: '10433394'}}
{bidder: 'appnexus', params: {placementId: '10433394'}}
]
}];
$$PREBID_GLOBAL$$.requestBids({adUnits});
Expand All @@ -1069,7 +1078,7 @@ describe('Unit: Prebid Module', function () {
nativeParams: {type: 'image'},
sizes: [[300, 250], [300, 600]],
bids: [
{bidder: 'appnexusAst', params: {placementId: 'id'}}
{bidder: 'appnexus', params: {placementId: 'id'}}
]
}];
$$PREBID_GLOBAL$$.requestBids({adUnits});
Expand Down
8 changes: 4 additions & 4 deletions test/spec/video_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('video.js', () => {
const bidRequests = [{
bids: [{
bidId: '123abc',
bidder: 'appnexusAst',
bidder: 'appnexus',
mediaTypes: {
video: { context: 'instream' }
}
Expand All @@ -28,7 +28,7 @@ describe('video.js', () => {
const bidRequests = [{
bids: [{
bidId: '123abc',
bidder: 'appnexusAst',
bidder: 'appnexus',
mediaTypes: {
video: { context: 'instream' }
}
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('video.js', () => {
const bidRequests = [{
bids: [{
bidId: '123abc',
bidder: 'appnexusAst',
bidder: 'appnexus',
mediaTypes: {
video: { context: 'outstream' }
}
Expand All @@ -82,7 +82,7 @@ describe('video.js', () => {
const bidRequests = [{
bids: [{
bidId: '123abc',
bidder: 'appnexusAst',
bidder: 'appnexus',
mediaTypes: {
video: { context: 'outstream' }
}
Expand Down

0 comments on commit 28d0703

Please sign in to comment.