merge userdb.js into users.js

This commit is contained in:
Girish Ramakrishnan
2021-07-15 09:50:11 -07:00
parent 2840bba4bf
commit a1c61facdc
27 changed files with 1021 additions and 1456 deletions

View File

@@ -202,14 +202,11 @@ describe('Profile API', function () {
});
it('can enable 2fa', async function () {
const totpToken = speakeasy.totp({
secret: secret,
encoding: 'base32'
});
const totpToken = speakeasy.totp({ secret, encoding: 'base32' });
await superagent.post(`${serverUrl}/api/v1/profile/twofactorauthentication_enable`)
.query({ access_token: user.token })
.send({ totpToken: totpToken });
.send({ totpToken });
});
it('fails due to missing token', async function () {

View File

@@ -159,11 +159,8 @@ describe('Users API', function () {
userWithPassword.id = response.body.id;
});
it('did set password of created user', function (done) {
users.verify(userWithPassword.id, userWithPassword.password, users.AP_WEBADMIN, function (error) {
expect(error).to.be(null);
done();
});
it('did set password of created user', async function () {
await users.verify(userWithPassword.id, userWithPassword.password, users.AP_WEBADMIN);
});
});
@@ -398,11 +395,8 @@ describe('Users API', function () {
expect(response.statusCode).to.equal(204);
});
it('did change the user password', function (done) {
users.verify(user.id, 'bigenough', users.AP_WEBADMIN, function (error) {
expect(error).to.be(null);
done();
});
it('did change the user password', async function () {
await users.verify(user.id, 'bigenough', users.AP_WEBADMIN);
});
});