always store the group names as lower case

This commit is contained in:
Girish Ramakrishnan
2016-09-30 12:33:18 -07:00
parent ba588a1cd7
commit cd0243d700
2 changed files with 11 additions and 0 deletions
+3
View File
@@ -78,6 +78,9 @@ function create(name, callback) {
assert.strictEqual(typeof name, 'string');
assert.strictEqual(typeof callback, 'function');
// we store names in lowercase
name = name.toLowerCase();
var error = validateGroupname(name);
if (error) return callback(error);
+8
View File
@@ -97,6 +97,14 @@ describe('Groups', function () {
});
});
it('cannot create existing group with mixed case', function (done) {
var name = GROUP0_NAME[0].toUpperCase() + GROUP0_NAME.substr(1);
groups.create(name, function (error, result) {
expect(error.reason).to.be(GroupError.ALREADY_EXISTS);
done();
});
});
it('did create mailbox', function (done) {
mailboxdb.getGroup(GROUP0_NAME.toLowerCase(), function (error, mailbox) {
expect(error).to.be(null);