Add app passwords feature
This commit is contained in:
@@ -678,6 +678,44 @@ 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('authcode', function () {
|
||||
var AUTHCODE_0 = {
|
||||
authCode: 'authcode-0',
|
||||
|
||||
Reference in New Issue
Block a user