async'ify avatar and apppassword code
This commit is contained in:
@@ -10,7 +10,6 @@ const appdb = require('../appdb.js'),
|
||||
async = require('async'),
|
||||
backupdb = require('../backupdb.js'),
|
||||
backups = require('../backups.js'),
|
||||
blobs = require('../blobs.js'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
database = require('../database'),
|
||||
domaindb = require('../domaindb'),
|
||||
@@ -512,44 +511,6 @@ describe('database', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('appPasswords', function () {
|
||||
before(function (done) {
|
||||
userdb.add(USER_0.id, USER_0, done);
|
||||
});
|
||||
after(function (done) {
|
||||
userdb.del(USER_0.id, done);
|
||||
});
|
||||
|
||||
it('can add app password', function (done) {
|
||||
userdb.addAppPassword('someid', { userId: USER_0.id, hashedPassword: 'hash', name: 'spark', identifier: 'appid' }, done);
|
||||
});
|
||||
|
||||
it('can get app password', function (done) {
|
||||
userdb.getAppPassword('someid', function (error, result) {
|
||||
if (error) return done(error);
|
||||
expect(result.hashedPassword).to.be('hash');
|
||||
expect(result.name).to.be('spark');
|
||||
expect(result.identifier).to.be('appid');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can get app passwords', function (done) {
|
||||
userdb.getAppPasswords(USER_0.id, function (error, results) {
|
||||
if (error) return done(error);
|
||||
expect(results.length).to.be(1);
|
||||
expect(results[0].hashedPassword).to.be('hash');
|
||||
expect(results[0].name).to.be('spark');
|
||||
expect(results[0].identifier).to.be('appid');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can del app password', function (done) {
|
||||
userdb.delAppPassword('someid', done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('apps', function () {
|
||||
var APP_0 = {
|
||||
id: 'appid-0',
|
||||
@@ -1008,27 +969,6 @@ describe('database', function () {
|
||||
|
||||
});
|
||||
|
||||
describe('blobs', function () {
|
||||
it('can set value', async function () {
|
||||
await blobs.set('someid', Buffer.from('somevalue'));
|
||||
});
|
||||
it('can get the set value', async function () {
|
||||
const value = await blobs.get('someid');
|
||||
expect(value).to.eql(Buffer.from('somevalue'));
|
||||
});
|
||||
it('can update a value', async function () {
|
||||
await blobs.set('someid', Buffer.from('someothervalue'));
|
||||
});
|
||||
it('can get updated value', async function () {
|
||||
const value = await blobs.get('someid');
|
||||
expect(value).to.eql(Buffer.from('someothervalue'));
|
||||
});
|
||||
it('cannot get randome value', async function () {
|
||||
const value = await blobs.get('unknownid');
|
||||
expect(value).to.be(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('backup', function () {
|
||||
|
||||
it('add succeeds', function (done) {
|
||||
|
||||
Reference in New Issue
Block a user