diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-11-02 22:36:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-02 22:36:05 +0100 |
commit | 39573e602d5e38e4b71b3d197d08798dd9558659 (patch) | |
tree | 1a4045bda8e05ad3537a9bf974834e1731a1e2cd /core/js/tests/specs | |
parent | 178d7f5bfa49bcf54d85ce788268ba592608627a (diff) | |
parent | 7d17b42f4df2322c1078c99840a9d35415ffd7aa (diff) | |
download | nextcloud-server-39573e602d5e38e4b71b3d197d08798dd9558659.tar.gz nextcloud-server-39573e602d5e38e4b71b3d197d08798dd9558659.zip |
Merge pull request #1978 from nextcloud/remove-send-mail-option
Remove send mail option
Diffstat (limited to 'core/js/tests/specs')
-rw-r--r-- | core/js/tests/specs/sharedialogshareelistview.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 72 | ||||
-rw-r--r-- | core/js/tests/specs/shareitemmodelSpec.js | 104 |
3 files changed, 3 insertions, 175 deletions
diff --git a/core/js/tests/specs/sharedialogshareelistview.js b/core/js/tests/specs/sharedialogshareelistview.js index 699e2e58d7b..bcc596a1386 100644 --- a/core/js/tests/specs/sharedialogshareelistview.js +++ b/core/js/tests/specs/sharedialogshareelistview.js @@ -34,8 +34,6 @@ describe('OC.Share.ShareDialogShareeListView', function () { oldAppConfig = _.extend({}, oc_appconfig.core); oc_appconfig.core.enforcePasswordForPublicLink = false; - $('#testArea').append('<input id="mailNotificationEnabled" name="mailNotificationEnabled" type="hidden" value="yes">'); - fileInfoModel = new OCA.Files.FileInfoModel({ id: 123, name: 'shared_file_name.txt', diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index f0e027d9fb9..6e86cb8eff7 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -41,7 +41,6 @@ describe('OC.Share.ShareDialogView', function() { beforeEach(function() { // horrible parameters $('#testArea').append('<input id="allowShareWithLink" type="hidden" value="yes">'); - $('#testArea').append('<input id="mailPublicNotificationEnabled" name="mailPublicNotificationEnabled" type="hidden" value="yes">'); $container = $('#shareContainer'); /* jshint camelcase:false */ oldAppConfig = _.extend({}, oc_appconfig.core); @@ -247,7 +246,7 @@ describe('OC.Share.ShareDialogView', function() { expect(slideToggleStub.callCount).toEqual(1); expect(slideToggleStub.getCall(0).thisValue.eq(0).attr('id')).toEqual('linkPass'); expect(fakeServer.requests.length).toEqual(0); - + // Now untoggle share by link dialog.$el.find('.linkCheckbox').click(); dialog.render(); @@ -402,76 +401,7 @@ describe('OC.Share.ShareDialogView', function() { expect($.datepicker._defaults.maxDate).toEqual(new Date(2014, 0, 27, 0, 0, 0, 0)); }); }); - describe('send link by email', function() { - var sendEmailPrivateLinkStub; - var clock; - - beforeEach(function() { - configModel.set({ - isMailPublicNotificationEnabled: true - }); - - shareModel.set('linkShare', { - isLinkShare: true, - token: 'tehtoken', - permissions: OC.PERMISSION_READ, - expiration: null - }); - - sendEmailPrivateLinkStub = sinon.stub(dialog.model, "sendEmailPrivateLink"); - clock = sinon.useFakeTimers(); - }); - afterEach(function() { - sendEmailPrivateLinkStub.restore(); - clock.restore(); - }); - it('displays form when sending emails is enabled', function() { - $('input[name=mailPublicNotificationEnabled]').val('yes'); - dialog.render(); - expect(dialog.$('.emailPrivateLinkForm').length).toEqual(1); - }); - it('form not rendered when sending emails is disabled', function() { - $('input[name=mailPublicNotificationEnabled]').val('no'); - dialog.render(); - expect(dialog.$('.emailPrivateLinkForm').length).toEqual(0); - }); - it('input cleared on success', function() { - var defer = $.Deferred(); - sendEmailPrivateLinkStub.returns(defer.promise()); - - $('input[name=mailPublicNotificationEnabled]').val('yes'); - dialog.render(); - - dialog.$el.find('.emailPrivateLinkForm .emailField').val('a@b.c'); - dialog.$el.find('#emailButton').trigger('click'); - - expect(sendEmailPrivateLinkStub.callCount).toEqual(1); - expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Sending ...'); - - defer.resolve(); - expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Email sent'); - - clock.tick(2000); - expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual(''); - }); - it('input not cleared on failure', function() { - var defer = $.Deferred(); - sendEmailPrivateLinkStub.returns(defer.promise()); - - $('input[name=mailPublicNotificationEnabled]').val('yes'); - dialog.render(); - - dialog.$el.find('.emailPrivateLinkForm .emailField').val('a@b.c'); - dialog.$el.find('#emailButton').trigger('click'); - - expect(sendEmailPrivateLinkStub.callCount).toEqual(1); - expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Sending ...'); - - defer.reject(); - expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('a@b.c'); - }); - }); }); describe('check for avatar', function() { beforeEach(function() { diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js index 9d9001dc9e8..1cddcb2acaa 100644 --- a/core/js/tests/specs/shareitemmodelSpec.js +++ b/core/js/tests/specs/shareitemmodelSpec.js @@ -464,107 +464,7 @@ describe('OC.Share.ShareItemModel', function() { }); }); - describe('sendEmailPrivateLink', function() { - it('succeeds', function() { - /* jshint camelcase: false */ - fetchReshareDeferred.resolve(makeOcsResponse([])); - fetchSharesDeferred.resolve(makeOcsResponse([{ - displayname_owner: 'root', - expiration: null, - file_source: 123, - file_target: '/folder', - id: 20, - item_source: '123', - item_type: 'folder', - mail_send: '0', - parent: null, - path: '/folder', - permissions: OC.PERMISSION_READ, - share_type: OC.Share.SHARE_TYPE_LINK, - share_with: null, - stime: 1403884258, - storage: 1, - token: 'tehtoken', - uid_owner: 'root' - }])); - OC.currentUser = 'root'; - model.fetch(); - - var res = model.sendEmailPrivateLink('foo@bar.com'); - - expect(res.state()).toEqual('pending'); - expect(fakeServer.requests.length).toEqual(1); - expect(fakeServer.requests[0].url).toEqual(OC.generateUrl('core/ajax/share.php')); - expect(OC.parseQueryString(fakeServer.requests[0].requestBody)).toEqual( - { - action: 'email', - toaddress: 'foo@bar.com', - link: model.get('linkShare').link, - itemType: 'file', - itemSource: '123', - file: 'shared_file_name.txt', - expiration: '' - } - ) - - fakeServer.requests[0].respond( - 200, - { 'Content-Type': 'application/json' }, - JSON.stringify({status: 'success'}) - ); - expect(res.state()).toEqual('resolved'); - }); - - it('fails', function() { - /* jshint camelcase: false */ - fetchReshareDeferred.resolve(makeOcsResponse([])); - fetchSharesDeferred.resolve(makeOcsResponse([{ - displayname_owner: 'root', - expiration: null, - file_source: 123, - file_target: '/folder', - id: 20, - item_source: '123', - item_type: 'folder', - mail_send: '0', - parent: null, - path: '/folder', - permissions: OC.PERMISSION_READ, - share_type: OC.Share.SHARE_TYPE_LINK, - share_with: null, - stime: 1403884258, - storage: 1, - token: 'tehtoken', - uid_owner: 'root' - }])); - OC.currentUser = 'root'; - model.fetch(); - - var res = model.sendEmailPrivateLink('foo@bar.com'); - - expect(res.state()).toEqual('pending'); - expect(fakeServer.requests.length).toEqual(1); - expect(fakeServer.requests[0].url).toEqual(OC.generateUrl('core/ajax/share.php')); - expect(OC.parseQueryString(fakeServer.requests[0].requestBody)).toEqual( - { - action: 'email', - toaddress: 'foo@bar.com', - link: model.get('linkShare').link, - itemType: 'file', - itemSource: '123', - file: 'shared_file_name.txt', - expiration: '' - } - ) - - fakeServer.requests[0].respond( - 200, - { 'Content-Type': 'application/json' }, - JSON.stringify({data: {message: 'fail'}, status: 'error'}) - ); - expect(res.state()).toEqual('rejected'); - }); - }); + describe('share permissions', function() { beforeEach(function() { oc_appconfig.core.resharingAllowed = true; @@ -635,7 +535,7 @@ describe('OC.Share.ShareItemModel', function() { addShareStub = sinon.stub(model, 'addShare'); updateShareStub = sinon.stub(model, 'updateShare'); }); - afterEach(function() { + afterEach(function() { addShareStub.restore(); updateShareStub.restore(); }); |