group: cannot set name of ldap group
This commit is contained in:
@@ -57,7 +57,7 @@ describe('Groups', function () {
|
||||
expect(error).to.be(null);
|
||||
group0Object = result;
|
||||
|
||||
[error, result] = await safe(groups.add({ name: group1Name }));
|
||||
[error, result] = await safe(groups.add({ name: group1Name, source: 'ldap' }));
|
||||
expect(error).to.be(null);
|
||||
group1Object = result;
|
||||
});
|
||||
@@ -171,4 +171,36 @@ describe('Groups', function () {
|
||||
await groups.remove(group0Object.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('update', function () {
|
||||
let groupObject;
|
||||
|
||||
before(async function () {
|
||||
let [error, result] = await safe(groups.add({ name: 'kootam' }));
|
||||
expect(error).to.be(null);
|
||||
groupObject = result;
|
||||
});
|
||||
|
||||
it('cannot set empty group name', async function () {
|
||||
const [error] = await safe(groups.setName(groupObject, ''));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('cannot set bad group name', async function () {
|
||||
const [error] = await safe(groups.setName(groupObject, '!kootam'));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('can set group name', async function () {
|
||||
await groups.setName(groupObject, 'kootam2');
|
||||
groupObject = await groups.get(groupObject.id);
|
||||
expect(groupObject.name).to.be('kootam2');
|
||||
});
|
||||
|
||||
it('cannot change ldap group name', async function () {
|
||||
const result = await groups.add({ name: 'ldap-kootam', source: 'ldap' });
|
||||
const [error] = await safe(groups.setName(result, 'ldap-kootam2'));
|
||||
expect(error.reason).to.be(BoxError.BAD_STATE);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user