tests: cleanup common variables

This commit is contained in:
Girish Ramakrishnan
2021-08-13 10:41:10 -07:00
parent aa981da43b
commit a8760f6c2c
20 changed files with 393 additions and 404 deletions
+117 -117
View File
@@ -15,19 +15,19 @@ const BoxError = require('../boxerror.js'),
_ = require('underscore');
describe('User', function () {
const { domainSetup, cleanup, ADMIN, USER, AUDIT_SOURCE } = common;
const { domainSetup, cleanup, admin, user, auditSource } = common;
async function cleanupUsers() {
for (const u of await users.getAll()) {
await users.del(u, AUDIT_SOURCE);
await users.del(u, auditSource);
}
}
async function createOwner() {
await cleanupUsers();
const id = await users.add(ADMIN.email, ADMIN, AUDIT_SOURCE);
ADMIN.id = id;
const id = await users.add(admin.email, admin, auditSource);
admin.id = id;
}
before(domainSetup);
@@ -44,60 +44,60 @@ describe('User', function () {
describe('add', function () {
it('fails due to short password', async function () {
const user = Object.assign({}, ADMIN, { password: 'Fo$%23' });
const [error] = await safe(users.add(user.email, user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { password: 'Fo$%23' });
const [error] = await safe(users.add(user.email, user, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('fails due to reserved username', async function () {
const user = Object.assign({}, ADMIN, { username: 'admin' });
const [error] = await safe(users.add(user.email, user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { username: 'admin' });
const [error] = await safe(users.add(user.email, user, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('fails due to invalid username', async function () {
const user = Object.assign({}, ADMIN, { username: 'moo+daemon' });
const [error] = await safe(users.add(user.email, user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { username: 'moo+daemon' });
const [error] = await safe(users.add(user.email, user, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('fails due to empty username', async function () {
const user = Object.assign({}, ADMIN, { username: '' });
const [error] = await safe(users.add(user.email, user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { username: '' });
const [error] = await safe(users.add(user.email, user, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('fails due to long username', async function () {
const user = Object.assign({}, ADMIN, { username: new Array(257).fill('Z').join('') });
const [error] = await safe(users.add(user.email, user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { username: new Array(257).fill('Z').join('') });
const [error] = await safe(users.add(user.email, user, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('fails due to reserved app pattern', async function () {
const user = Object.assign({}, ADMIN, { username: 'maybe.app' });
const [error] = await safe(users.add(user.email, user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { username: 'maybe.app' });
const [error] = await safe(users.add(user.email, user, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('fails because password is empty', async function () {
const user = Object.assign({}, ADMIN, { password: '' });
const [error] = await safe(users.add(user.email, user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { password: '' });
const [error] = await safe(users.add(user.email, user, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('can add user', async function () {
const id = await users.add(ADMIN.email, ADMIN, AUDIT_SOURCE);
ADMIN.id = id;
const id = await users.add(admin.email, admin, auditSource);
admin.id = id;
});
it('cannot add user with same email again', async function () {
const [error] = await safe(users.add(ADMIN.email, ADMIN, AUDIT_SOURCE));
const [error] = await safe(users.add(admin.email, admin, auditSource));
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
expect(error.message).to.equal('email already exists');
});
it('cannot add user with same username again', async function () {
const [error] = await safe(users.add('somethingelse@not.taken', ADMIN, AUDIT_SOURCE));
const [error] = await safe(users.add('somethingelse@not.taken', admin, auditSource));
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
expect(error.message).to.equal('username already exists');
});
@@ -117,45 +117,45 @@ describe('User', function () {
});
it('getOwner succeeds', async function () {
const id = await users.add(ADMIN.email, ADMIN, AUDIT_SOURCE);
ADMIN.id = id;
const id = await users.add(admin.email, admin, auditSource);
admin.id = id;
const owner = await users.getOwner();
checkUser(owner, ADMIN);
checkUser(owner, admin);
});
it('can get by user id', async function () {
const result = await users.get(ADMIN.id);
checkUser(result, ADMIN);
const result = await users.get(admin.id);
checkUser(result, admin);
});
it('can get by username', async function () {
const result = await users.getByUsername(ADMIN.username);
checkUser(result, ADMIN);
const result = await users.getByUsername(admin.username);
checkUser(result, admin);
});
it('can get by email', async function () {
const result = await users.getByEmail(ADMIN.email);
checkUser(result, ADMIN);
const result = await users.getByEmail(admin.email);
checkUser(result, admin);
});
it('add another admin', async function () {
const result = await users.add(USER.email, USER, AUDIT_SOURCE);
USER.id = result;
await users.update(USER, { role: users.ROLE_ADMIN }, AUDIT_SOURCE);
USER.role = users.ROLE_ADMIN;
const result = await users.add(user.email, user, auditSource);
user.id = result;
await users.update(user, { role: users.ROLE_ADMIN }, auditSource);
user.role = users.ROLE_ADMIN;
});
it('getSuperadmins succeeds', async function () {
const results = await users.getSuperadmins();
expect(results.length).to.be(1);
checkUser(results[0], ADMIN);
checkUser(results[0], admin);
});
it('getAdmins succeeds', async function () {
const results = await users.getAdmins();
expect(results.length).to.be(2);
checkUser(results[0], ADMIN); // owner is always the first
checkUser(results[1], USER);
checkUser(results[0], admin); // owner is always the first
checkUser(results[1], user);
});
it('getByResetToken fails for empty resetToken', async function () {
@@ -169,33 +169,33 @@ describe('User', function () {
});
it('can get by resetToken', async function () {
USER.resetToken = new Array(64).fill('X').join('');
await users.update(USER, { resetToken: USER.resetToken }, AUDIT_SOURCE);
const user = await users.getByResetToken(USER.resetToken);
checkUser(user, USER);
user.resetToken = new Array(64).fill('X').join('');
await users.update(user, { resetToken: user.resetToken }, auditSource);
const user = await users.getByResetToken(user.resetToken);
checkUser(user, user);
});
it('can getAll', async function () {
const results = await users.getAll();
expect(results.length).to.be(2);
checkUser(results[0], ADMIN);
checkUser(results[1], USER);
checkUser(results[0], admin);
checkUser(results[1], user);
});
it('can getAllPaged', async function () {
let results = await users.getAllPaged(null, 1, 1);
expect(results.length).to.be(1);
checkUser(results[0], ADMIN);
checkUser(results[0], admin);
results = await users.getAllPaged(null, 2, 1);
expect(results.length).to.be(1);
checkUser(results[0], USER);
checkUser(results[0], user);
});
it('can getAllPaged (search)', async function () {
let results = await users.getAllPaged(ADMIN.email.slice(0, 8), 1, 1);
let results = await users.getAllPaged(admin.email.slice(0, 8), 1, 1);
expect(results.length).to.be(1);
checkUser(results[0], ADMIN);
checkUser(results[0], admin);
});
});
@@ -203,34 +203,34 @@ describe('User', function () {
before(createOwner);
it('fails due to unknown userid', async function () {
const user = Object.assign({}, ADMIN, { id: 'random' });
const [error] = await safe(users.update(user, { displayName: 'full name' }, AUDIT_SOURCE));
const user = Object.assign({}, admin, { id: 'random' });
const [error] = await safe(users.update(user, { displayName: 'full name' }, auditSource));
expect(error.reason).to.equal(BoxError.NOT_FOUND);
});
it('fails due to invalid email', async function () {
const [error] = await safe(users.update(ADMIN, { email: 'brokenemailaddress' }, AUDIT_SOURCE));
const [error] = await safe(users.update(admin, { email: 'brokenemailaddress' }, auditSource));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
xit('cannot update the user with already existing email', async function () {
const result = await users.add(USER.email, USER, AUDIT_SOURCE);
USER.id = result;
const result = await users.add(user.email, user, auditSource);
user.id = result;
const [error] = await safe(users.update(ADMIN, { email: USER.email }), AUDIT_SOURCE);
const [error] = await safe(users.update(admin, { email: user.email }), auditSource);
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
expect(error.message).to.equal('email already exists');
});
xit('can update the user with already existing username', async function () {
const [error] = await safe(users.update(ADMIN, { username: USER.username }), AUDIT_SOURCE);
const [error] = await safe(users.update(admin, { username: user.username }), auditSource);
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
expect(error.message).to.equal('username already exists');
});
xit('can update the user', async function () {
await users.update(ADMIN, { email: 'some@thing.com', displayName: 'Heiter' }, AUDIT_SOURCE);
const user = await users.get(ADMIN.id);
await users.update(admin, { email: 'some@thing.com', displayName: 'Heiter' }, auditSource);
const user = await users.get(admin.id);
expect(user.email).to.equal('some@thing.com');
expect(user.displayName).to.equal('Heiter');
});
@@ -245,33 +245,33 @@ describe('User', function () {
});
it('fails due to empty password', async function () {
const [error] = await safe(users.verify(ADMIN.id, '', users.AP_WEBADMIN));
const [error] = await safe(users.verify(admin.id, '', users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
it('fails due to wrong password', async function () {
const [error] = await safe(users.verify(ADMIN.id, ADMIN.password+'x', users.AP_WEBADMIN));
const [error] = await safe(users.verify(admin.id, admin.password+'x', users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
it('succeeds', async function () {
const result = await users.verify(ADMIN.id, ADMIN.password, users.AP_WEBADMIN);
const result = await users.verify(admin.id, admin.password, users.AP_WEBADMIN);
expect(result).to.be.ok();
expect(result.appPassword).to.not.be.ok();
expect(result.ghost).to.not.be.ok();
});
it('fails for ghost if not enabled', async function () {
const [error] = await safe(users.verify(ADMIN.id, 'foobar', users.AP_WEBADMIN));
const [error] = await safe(users.verify(admin.id, 'foobar', users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
it('fails for ghost with wrong password', async function () {
let ghost = { };
ghost[ADMIN.username] = 'testpassword';
ghost[admin.username] = 'testpassword';
await fs.promises.writeFile(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
const [error] = await safe(users.verify(ADMIN.id, 'foobar', users.AP_WEBADMIN));
const [error] = await safe(users.verify(admin.id, 'foobar', users.AP_WEBADMIN));
await fs.promises.unlink(paths.GHOST_USER_FILE);
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
@@ -279,25 +279,25 @@ describe('User', function () {
it('succeeds for ghost', async function () {
let ghost = { };
ghost[ADMIN.username] = 'testpassword';
ghost[admin.username] = 'testpassword';
await fs.promises.writeFile(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
const result = await users.verify(ADMIN.id, 'testpassword', users.AP_WEBADMIN);
const result = await users.verify(admin.id, 'testpassword', users.AP_WEBADMIN);
if (fs.existsSync(paths.GHOST_USER_FILE)) throw new Error('Ghost file exists after verification');
expect(result.id).to.equal(ADMIN.id);
expect(result.id).to.equal(admin.id);
expect(result.ghost).to.be(true);
});
it('succeeds for normal user password when ghost file exists', async function () {
let ghost = { };
ghost[ADMIN.username] = 'testpassword';
ghost[admin.username] = 'testpassword';
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
const result = await users.verify(ADMIN.id, ADMIN.password, users.AP_WEBADMIN);
const result = await users.verify(admin.id, admin.password, users.AP_WEBADMIN);
if (!fs.existsSync(paths.GHOST_USER_FILE)) throw new Error('Ghost file went way without verification');
expect(result.id).to.equal(ADMIN.id);
expect(result.id).to.equal(admin.id);
expect(result.ghost).to.not.be.ok();
});
});
@@ -311,32 +311,32 @@ describe('User', function () {
});
it('fails due to empty password', async function () {
const [error] = await safe(users.verifyWithUsername(ADMIN.username, '', users.AP_WEBADMIN));
const [error] = await safe(users.verifyWithUsername(admin.username, '', users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
it('fails due to wrong password', async function () {
const [error] = await safe(users.verifyWithUsername(ADMIN.username, 'somepass', users.AP_WEBADMIN));
const [error] = await safe(users.verifyWithUsername(admin.username, 'somepass', users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
it('succeeds', async function () {
const result = await users.verifyWithUsername(ADMIN.username, ADMIN.password, users.AP_WEBADMIN);
expect(result.id).to.equal(ADMIN.id);
const result = await users.verifyWithUsername(admin.username, admin.password, users.AP_WEBADMIN);
expect(result.id).to.equal(admin.id);
});
it('succeeds for different username case', async function () {
const result = await users.verifyWithUsername(ADMIN.username.toUpperCase(), ADMIN.password, users.AP_WEBADMIN);
expect(result.id).to.equal(ADMIN.id);
const result = await users.verifyWithUsername(admin.username.toUpperCase(), admin.password, users.AP_WEBADMIN);
expect(result.id).to.equal(admin.id);
});
it('fails for ghost with wrong password', async function () {
let ghost = { };
ghost[ADMIN.username] = 'testpassword';
ghost[admin.username] = 'testpassword';
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
const [error] = await safe(users.verifyWithUsername(ADMIN.username, 'foobar', users.AP_WEBADMIN));
const [error] = await safe(users.verifyWithUsername(admin.username, 'foobar', users.AP_WEBADMIN));
if (!fs.existsSync(paths.GHOST_USER_FILE)) throw new Error('Ghost file went way without verification');
fs.unlinkSync(paths.GHOST_USER_FILE);
@@ -345,13 +345,13 @@ describe('User', function () {
it('succeeds for ghost', async function () {
let ghost = { };
ghost[ADMIN.username] = 'testpassword';
ghost[admin.username] = 'testpassword';
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
const result = await users.verifyWithUsername(ADMIN.username, 'testpassword', users.AP_WEBADMIN);
const result = await users.verifyWithUsername(admin.username, 'testpassword', users.AP_WEBADMIN);
if (fs.existsSync(paths.GHOST_USER_FILE)) throw new Error('Ghost file still around!');
expect(result.id).to.equal(ADMIN.id);
expect(result.id).to.equal(admin.id);
expect(result.ghost).to.be(true);
});
});
@@ -360,37 +360,37 @@ describe('User', function () {
before(createOwner);
it('fails due to non existing user', async function () {
const [error] = await safe(users.verifyWithEmail('bad@email.com', ADMIN.password, users.AP_WEBADMIN));
const [error] = await safe(users.verifyWithEmail('bad@email.com', admin.password, users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.NOT_FOUND);
});
it('fails due to empty password', async function () {
const [error] = await safe(users.verifyWithEmail(ADMIN.email, '', users.AP_WEBADMIN));
const [error] = await safe(users.verifyWithEmail(admin.email, '', users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
it('fails due to wrong password', async function () {
const [error] = await safe(users.verifyWithEmail(ADMIN.email, 'badpassword', users.AP_WEBADMIN));
const [error] = await safe(users.verifyWithEmail(admin.email, 'badpassword', users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
it('succeeds', async function () {
const result = await users.verifyWithEmail(ADMIN.email, ADMIN.password, users.AP_WEBADMIN);
expect(result.id).to.be(ADMIN.id);
const result = await users.verifyWithEmail(admin.email, admin.password, users.AP_WEBADMIN);
expect(result.id).to.be(admin.id);
});
it('succeeds for different email case', async function () {
const result = await users.verifyWithEmail(ADMIN.email.toUpperCase(), ADMIN.password, users.AP_WEBADMIN);
expect(result.id).to.be(ADMIN.id);
const result = await users.verifyWithEmail(admin.email.toUpperCase(), admin.password, users.AP_WEBADMIN);
expect(result.id).to.be(admin.id);
});
it('fails for ghost with wrong password', async function () {
let ghost = { };
ghost[ADMIN.username] = 'testpassword';
ghost[admin.username] = 'testpassword';
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
const [error] = await safe(users.verifyWithEmail(ADMIN.email, 'foobar', users.AP_WEBADMIN));
const [error] = await safe(users.verifyWithEmail(admin.email, 'foobar', users.AP_WEBADMIN));
if (!fs.existsSync(paths.GHOST_USER_FILE)) throw new Error('Ghost file not found after failed login!');
fs.unlinkSync(paths.GHOST_USER_FILE);
@@ -399,14 +399,14 @@ describe('User', function () {
it('succeeds for ghost', async function () {
let ghost = { };
ghost[ADMIN.username] = 'testpassword';
ghost[admin.username] = 'testpassword';
fs.writeFileSync(paths.GHOST_USER_FILE, JSON.stringify(ghost), 'utf8');
const result = await users.verifyWithEmail(ADMIN.email, 'testpassword', users.AP_WEBADMIN);
const result = await users.verifyWithEmail(admin.email, 'testpassword', users.AP_WEBADMIN);
if (fs.existsSync(paths.GHOST_USER_FILE)) throw new Error('Ghost file still around!');
expect(result.id).to.equal(ADMIN.id);
expect(result.id).to.equal(admin.id);
expect(result.ghost).to.equal(true);
});
});
@@ -415,14 +415,14 @@ describe('User', function () {
before(createOwner);
it('verify fails for inactive user', async function () {
await users.update(ADMIN, { active: false }, AUDIT_SOURCE);
const [error] = await safe(users.verify(ADMIN.id, ADMIN.password, users.AP_WEBADMIN));
await users.update(admin, { active: false }, auditSource);
const [error] = await safe(users.verify(admin.id, admin.password, users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.NOT_FOUND);
});
it('verify succeeds for inactive user', async function () {
await users.update(ADMIN, { active: true }, AUDIT_SOURCE);
await users.verify(ADMIN.id, ADMIN.password, users.AP_WEBADMIN);
await users.update(admin, { active: true }, auditSource);
await users.verify(admin.id, admin.password, users.AP_WEBADMIN);
});
});
@@ -435,12 +435,12 @@ describe('User', function () {
});
it('succeeds', async function () {
const result = await users.get(ADMIN.id);
expect(result.id).to.equal(ADMIN.id);
expect(result.email).to.equal(ADMIN.email.toLowerCase());
expect(result.fallbackEmail).to.equal(ADMIN.email.toLowerCase());
expect(result.username).to.equal(ADMIN.username.toLowerCase());
expect(result.displayName).to.equal(ADMIN.displayName);
const result = await users.get(admin.id);
expect(result.id).to.equal(admin.id);
expect(result.email).to.equal(admin.email.toLowerCase());
expect(result.fallbackEmail).to.equal(admin.email.toLowerCase());
expect(result.username).to.equal(admin.username.toLowerCase());
expect(result.displayName).to.equal(admin.displayName);
});
});
@@ -464,32 +464,32 @@ describe('User', function () {
before(createOwner);
it('fails due to unknown user', async function () {
const user = Object.assign({}, ADMIN, { id: 'doesnotexist' });
const [error] = await safe(users.setPassword(user, 'newpassword', AUDIT_SOURCE));
const user = Object.assign({}, admin, { id: 'doesnotexist' });
const [error] = await safe(users.setPassword(user, 'newpassword', auditSource));
expect(error.reason).to.be(BoxError.NOT_FOUND);
});
it('fails due to empty password', async function () {
const [error] = await safe(users.setPassword(ADMIN, '', AUDIT_SOURCE));
const [error] = await safe(users.setPassword(admin, '', auditSource));
expect(error.reason).to.be(BoxError.BAD_FIELD);
});
it('fails due to invalid password', async function () {
const [error] = await safe(users.setPassword(ADMIN, 'foobar', AUDIT_SOURCE));
const [error] = await safe(users.setPassword(admin, 'foobar', auditSource));
expect(error.reason).to.be(BoxError.BAD_FIELD);
});
it('succeeds', async function () {
await users.setPassword(ADMIN, 'ThisIsNew1Password', AUDIT_SOURCE);
await users.setPassword(admin, 'ThisIsNew1Password', auditSource);
});
it('actually changed the password (unable to login with old pasword)', async function () {
const [error] = await safe(users.verify(ADMIN.id, ADMIN.password, users.AP_WEBADMIN));
const [error] = await safe(users.verify(admin.id, admin.password, users.AP_WEBADMIN));
expect(error.reason).to.equal(BoxError.INVALID_CREDENTIALS);
});
xit('actually changed the password (login with new password)', async function () {
await users.verify(ADMIN.id, 'ThisIsNew1Password', users.AP_WEBADMIN);
await users.verify(admin.id, 'ThisIsNew1Password', users.AP_WEBADMIN);
});
});
@@ -497,22 +497,22 @@ describe('User', function () {
before(cleanupUsers);
it('fails due to unkown email', async function () {
const [error] = await safe(users.sendPasswordResetByIdentifier('unknown@mail.com', AUDIT_SOURCE));
const [error] = await safe(users.sendPasswordResetByIdentifier('unknown@mail.com', auditSource));
expect(error.reason).to.eql(BoxError.NOT_FOUND);
});
it('fails due to unkown username', async function () {
const [error] = await safe(users.sendPasswordResetByIdentifier('unknown', AUDIT_SOURCE));
const [error] = await safe(users.sendPasswordResetByIdentifier('unknown', auditSource));
expect(error.reason).to.eql(BoxError.NOT_FOUND);
});
it('succeeds with email', async function () {
await users.sendPasswordResetByIdentifier(ADMIN.email);
await users.sendPasswordResetByIdentifier(admin.email);
// checkMails(1, done);
});
it('succeeds with username', async function () {
await users.sendPasswordResetByIdentifier(ADMIN.username);
await users.sendPasswordResetByIdentifier(admin.username);
// checkMails(1, done);
});
});
@@ -521,7 +521,7 @@ describe('User', function () {
before(createOwner);
it('fails as expected', async function () {
const [error] = await safe(users.sendInvite(ADMIN, { }));
const [error] = await safe(users.sendInvite(admin, { }));
expect(error.reason).to.be(BoxError.CONFLICT);
});
@@ -545,13 +545,13 @@ describe('User', function () {
before(createOwner);
it('fails for unknown user', async function () {
const user = Object.assign({}, ADMIN, { id: 'doesnotexist' });
const [error] = await safe(users.del(user, AUDIT_SOURCE));
const user = Object.assign({}, admin, { id: 'doesnotexist' });
const [error] = await safe(users.del(user, auditSource));
expect(error.reason).to.be(BoxError.NOT_FOUND);
});
it('can remove valid user', async function () {
await users.del(ADMIN, AUDIT_SOURCE);
await users.del(admin, auditSource);
});
it('can re-create user after user was removed', createOwner);