mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add test to check if in the case user contains token, Node-RED uses it instead of generating a new Token
This commit is contained in:
parent
450888f542
commit
79a789c557
@ -92,7 +92,23 @@ describe("api/auth/strategies", function() {
|
|||||||
tokenCreate.restore();
|
tokenCreate.restore();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Uses provided token on authentication success and token provided',function(done) {
|
||||||
|
userAuthentication = sinon.stub(Users,"authenticate").callsFake(function(username,password) {
|
||||||
|
return Promise.resolve({username:"user",permissions:"*",token:"123456"});
|
||||||
|
});
|
||||||
|
|
||||||
|
strategies.passwordTokenExchange({id:"myclient"},"user","password","read",function(err,token) {
|
||||||
|
try {
|
||||||
|
should.not.exist(err);
|
||||||
|
token.should.equal("123456");
|
||||||
|
done();
|
||||||
|
} catch(e) {
|
||||||
|
done(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user