fixes auth in test

This commit is contained in:
Todd Treece 2015-08-24 18:44:12 -04:00
parent ea707d7abc
commit e8c0d5d088

View file

@ -11,12 +11,7 @@ describe('NPR One', function() {
it('should create a client', function(done) {
npr = NPR({
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
username: process.env.NPR_USERNAME,
password: process.env.NPR_PASSWORD
});
npr = NPR();
npr.one.init()
.then(function() { done(); })
@ -31,12 +26,20 @@ describe('NPR One', function() {
it('should get an access token using password grant type', function(done) {
npr.one.authorization
.createToken(npr.one.credentials)
.createToken({
grant_type: 'password',
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
username: process.env.NPR_USERNAME,
password: process.env.NPR_PASSWORD
})
.then(function(res) {
if(! res.access_token)
return done('missing access token');
npr.one.setAccessToken(res.access_token);
done();
}).catch(done);