Skip to content

Commit

Permalink
fix(FEC-8679): isAnonymous is set incorrectly (#68)
Browse files Browse the repository at this point in the history
If session is only passed on `getMediaConfig` and on the provider constructor than the `isAnonymous` session flag is not set to false.
  • Loading branch information
OrenMe authored Nov 19, 2018
1 parent 10291ca commit c843f73
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/k-provider/ott/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class OTTProvider extends BaseProvider<OTTProviderMediaInfoObject
getMediaConfig(mediaInfo: OTTProviderMediaInfoObject): Promise<ProviderMediaConfigObject> {
if (mediaInfo.ks) {
this.ks = mediaInfo.ks;
this._isAnonymous = false;
}
this._dataLoader = new OTTDataLoaderManager(this.partnerId, this.ks, this._networkRetryConfig);
return new Promise((resolve, reject) => {
Expand Down
1 change: 1 addition & 0 deletions src/k-provider/ovp/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default class OVPProvider extends BaseProvider<ProviderMediaInfoObject> {
getMediaConfig(mediaInfo: ProviderMediaInfoObject): Promise<ProviderMediaConfigObject> {
if (mediaInfo.ks) {
this.ks = mediaInfo.ks;
this._isAnonymous = false;
}
this._dataLoader = new OVPDataLoaderManager(this.playerVersion, this.partnerId, this.ks, this._networkRetryConfig);
return new Promise((resolve, reject) => {
Expand Down
39 changes: 39 additions & 0 deletions test/src/k-provider/ovp/provider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,45 @@ describe('OVPProvider.partnerId:1068292', function() {
});
});

describe('getMediaConfig', function() {
let provider, sandbox;
const partnerId = 1068292;
const ks =
'NTAwZjViZWZjY2NjNTRkNGEyMjU1MTg4OGE1NmUwNDljZWJkMzk1MXwxMDY4MjkyOzEwNjgyOTI7MTQ5MDE3NjE0NjswOzE0OTAwODk3NDYuMDIyNjswO3ZpZXc6Kix3aWRnZXQ6MTs7';
const playerVersion = '1.2.3';

beforeEach(() => {
sandbox = sinon.sandbox.create();
provider = new OVPProvider({partnerId: partnerId}, playerVersion);
});

afterEach(() => {
sandbox.restore();
MultiRequestBuilder.prototype.execute.restore();
});

it('should set anonymous to false when given a KS', done => {
sinon.stub(MultiRequestBuilder.prototype, 'execute').callsFake(function() {
return new Promise(resolve => {
resolve({response: new MultiRequestResult(BE_DATA.AnonymousMocEntryWithoutUIConfWithDrmData.response)});
});
});
provider.getMediaConfig({entryId: '1_rwbj3j0a', ks: ks}).then(
mediaConfig => {
try {
mediaConfig.session.isAnonymous.should.be.false;
done();
} catch (err) {
done(err);
}
},
err => {
done(err);
}
);
});
});

describe('logger', () => {
const partnerId = 1068292;
const playerVersion = '1.2.3';
Expand Down

0 comments on commit c843f73

Please sign in to comment.