tokens: async'ify
This commit is contained in:
@@ -7,7 +7,7 @@ const async = require('async'),
|
||||
server = require('../../server.js'),
|
||||
settings = require('../../settings.js'),
|
||||
superagent = require('superagent'),
|
||||
tokendb = require('../../tokendb.js');
|
||||
tokens = require('../../tokens.js');
|
||||
|
||||
exports = module.exports = {
|
||||
setup,
|
||||
@@ -66,7 +66,7 @@ function setup(done) {
|
||||
superagent.post(`${serverUrl}/api/v1/users`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ username: user.username, email: user.email })
|
||||
.end(function (error, result) {
|
||||
.end(async function (error, result) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(result.statusCode).to.equal(201);
|
||||
|
||||
@@ -74,7 +74,9 @@ function setup(done) {
|
||||
user.token = 'usertoken';
|
||||
|
||||
// HACK to get a token for second user (passwords are generated and the user should have gotten a password setup link...)
|
||||
tokendb.add({ id: 'tid-3', accessToken: user.token, identifier: user.id, clientId: 'test-client-id', expires: Date.now() + 10000, scope: 'unused', name: 'fromtest' }, callback);
|
||||
const token = await tokens.add({ identifier: user.id, clientId: 'test-client-id', expires: Date.now() + 10000, name: 'fromtest' });
|
||||
user.token = token.accessToken;
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user