directoryserver: 2fa validation tests

This commit is contained in:
Girish Ramakrishnan
2024-01-06 13:25:12 +01:00
parent c422e2d570
commit e13f427267
2 changed files with 35 additions and 2 deletions
+6
View File
@@ -436,6 +436,12 @@ describe('User', function () {
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
expect(error.message).to.be('Invalid totpToken');
});
it('verify succeeds with valid 2fa', async function () {
const totpToken = speakeasy.totp({ secret: twofa.secret, encoding: 'base32' });
const user = await users.verifyWithUsername(admin.username, admin.password, users.AP_WEBADMIN, { totpToken });
expect(user.id).to.be(admin.id);
});
});
describe('active', function () {