aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-09-01 12:51:49 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-02-27 12:29:25 +0100
commit7466468af1a4c830c7bb825fda141a336d541b0d (patch)
tree948b432c8ec737e66382aa7b43e5b0f649835207
parent3285becdc16a9eb57a507e6ad58100d392f2894a (diff)
downloadnextcloud-server-7466468af1a4c830c7bb825fda141a336d541b0d.tar.gz
nextcloud-server-7466468af1a4c830c7bb825fda141a336d541b0d.zip
Fix share capabilities JS tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
-rw-r--r--core/js/tests/specs/shareitemmodelSpec.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js
index 3b17051508e..0a345786b73 100644
--- a/core/js/tests/specs/shareitemmodelSpec.js
+++ b/core/js/tests/specs/shareitemmodelSpec.js
@@ -25,6 +25,7 @@ describe('OC.Share.ShareItemModel', function() {
var fetchSharesDeferred, fetchReshareDeferred;
var fileInfoModel, configModel, model;
var oldCurrentUser;
+ var capsSpec;
beforeEach(function() {
oldCurrentUser = OC.currentUser;
@@ -56,8 +57,15 @@ describe('OC.Share.ShareItemModel', function() {
configModel: configModel,
fileInfoModel: fileInfoModel
});
+ capsSpec = sinon.stub(OC, 'getCapabilities');
+ capsSpec.returns({
+ 'files_sharing': {
+ 'default_permissions': OC.PERMISSION_ALL
+ }
+ });
});
afterEach(function() {
+ capsSpec.restore();
if (fetchSharesStub) {
fetchSharesStub.restore();
}
@@ -527,7 +535,22 @@ describe('OC.Share.ShareItemModel', function() {
});
expect(
testWithPermissions(OC.PERMISSION_UPDATE | OC.PERMISSION_SHARE)
- ).toEqual(OC.PERMISSION_READ | OC.PERMISSION_UPDATE | OC.PERMISSION_UPDATE);
+ ).toEqual(OC.PERMISSION_READ | OC.PERMISSION_UPDATE);
+ });
+ it('uses default permissions from capabilities', function() {
+ capsSpec.returns({
+ 'files_sharing': {
+ 'default_permissions': OC.PERMISSION_READ | OC.PERMISSION_CREATE | OC.PERMISSION_SHARE
+ }
+ });
+ configModel.set('isResharingAllowed', true);
+ model.set({
+ reshare: {},
+ shares: []
+ });
+ expect(
+ testWithPermissions(OC.PERMISSION_ALL)
+ ).toEqual(OC.PERMISSION_READ | OC.PERMISSION_CREATE | OC.PERMISSION_SHARE);
});
});
});