Skip to content

Commit

Permalink
Merge branches 'w/8.1/feature/S3C-3112_ObjectLockEnabledSetterForBuck…
Browse files Browse the repository at this point in the history
…et' and 'q/1174/7.8/feature/S3C-3112_ObjectLockEnabledSetterForBucket' into tmp/octopus/q/8.1
  • Loading branch information
bert-e committed Jun 30, 2020
3 parents c1cfc59 + 6383d14 + 9f90e1e commit 668d90b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/models/BucketInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,12 +712,21 @@ class BucketInfo {
return this;
}
/**
* Check is object lock enabled.
* Check if object lock is enabled.
* @return {boolean} - depending on whether object lock is enabled
*/
isObjectLockEnabled() {
return !!this._objectLockEnabled;
}
/**
* Set the value of objectLockEnabled field.
* @param {boolean} enabled - true if object lock enabled else false.
* @return {BucketInfo} - bucket info instance
*/
setObjectLockEnabled(enabled) {
this._objectLockEnabled = enabled;
return this;
}
}

module.exports = BucketInfo;
7 changes: 7 additions & 0 deletions tests/unit/models/BucketInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,13 @@ Object.keys(acl).forEach(
assert.deepStrictEqual(dummyBucket.getObjectLockConfiguration(),
newObjectLockConfig);
});
[true, false].forEach(bool => {
it('setObjectLockEnabled should set object lock status', () => {
dummyBucket.setObjectLockEnabled(bool);
assert.deepStrictEqual(dummyBucket.isObjectLockEnabled(),
bool);
});
});
});
})
);
Expand Down

0 comments on commit 668d90b

Please sign in to comment.