Skip to content

Commit

Permalink
plugin utils for twitter tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
thanpolas committed Mar 13, 2013
1 parent 6480a7c commit bd724cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions test/bdd/modules/userAuth/plugins/pluginInterface.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ssd.test.userAuth.genIface = function(params) {
this.pluginSpace = params.pluginSpace;
this.hasJSAPI = params.hasJSAPI;
this.pluginResponse = params.pluginResponse;
this.accessToken = params.accessToken;
this.pluginUDO = params.pluginUDO;
this.eventJSLoaded = params.eventJSLoaded;
this.eventInitialAuthStatus = params.eventInitialAuthStatus;
Expand Down Expand Up @@ -255,10 +256,12 @@ ssd.test.userAuth.genIface.prototype.loginTests = function() {
});

describe('utility methods', function() {
var spyCB;
beforeEach(function() {
spyCB = sinon.spy.create('loginCB');
plugin.login(spyCB);
_this.beforeEach();
plugin.login(spyCB);
_this.afterLogin();
});
afterEach(function() {
_this.afterEach();
Expand All @@ -268,9 +271,9 @@ ssd.test.userAuth.genIface.prototype.loginTests = function() {
expect( plugin.hasJSAPI() ).to.equal(_this.hasJSAPI);
});

it('should try to verify with local server', function(){
it('should verify with local server', function(){
plugin.login();
expect( stubNet.calledOnce ).to.be.true;
expect( stubNet.calledOnce === plugin.hasLocalAuth() ).to.be.true;
});

it('should globally authenticate us', function(){
Expand All @@ -292,7 +295,8 @@ ssd.test.userAuth.genIface.prototype.loginTests = function() {

it('should return the Access Token of the plugin', function(){
plugin.login();
expect( plugin.getAccessToken() ).to.equal(_this.pluginResponse.authResponse.accessToken);
expect( plugin.getAccessToken() ).to.equal(
_this.accessToken);
});
});
});
Expand Down
3 changes: 2 additions & 1 deletion test/bdd/modules/userAuth/plugins/twitter.auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ describe('User Auth Module Plugins :: Twitter', function () {
pluginName: 'twitter',
pluginNameSpace: 'tw',
hasJSAPI: false,
pluginUDO: fixtures.auth.tw.udo,
pluginUDO: {},//fixtures.auth.tw.udo,
pluginResponse: 'access_token',
accessToken: 'access_token',
loginCbArg4Type: 'null',
loginCbArg5Type: 'string',
loginCbHasUdo: false,
Expand Down

0 comments on commit bd724cc

Please sign in to comment.