summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-12-16 17:35:53 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-24 21:45:00 +0200
commit59c5be1cc572793a8d50e87ab589e1cc4cf2ed12 (patch)
tree97b096fee075115bac45d69f2e0da7af5ffb41f2 /apps/files_sharing/tests
parent4d01f23978549c2a33e9fdfdc3b9308cc9dc1078 (diff)
downloadnextcloud-server-59c5be1cc572793a8d50e87ab589e1cc4cf2ed12.tar.gz
nextcloud-server-59c5be1cc572793a8d50e87ab589e1cc4cf2ed12.zip
Use Webdav PUT for uploads in the web browser
- uses PUT method with jquery.fileupload for regular and public file lists - for IE and browsers that don't support it, use POST with iframe transport - implemented Sabre plugin to handle iframe transport and redirect the embedded PUT request to the proper handler - added RFC5995 POST to file collection with "add-member" property to make it possible to auto-rename conflicting file names - remove obsolete ajax/upload.php and obsolete ajax routes Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/js/publicAppSpec.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/js/publicAppSpec.js b/apps/files_sharing/tests/js/publicAppSpec.js
index 58565744882..e8ec9899ecc 100644
--- a/apps/files_sharing/tests/js/publicAppSpec.js
+++ b/apps/files_sharing/tests/js/publicAppSpec.js
@@ -87,10 +87,18 @@ describe('OCA.Sharing.PublicApp tests', function() {
});
it('Uses public webdav endpoint', function() {
+ App._initialized = false;
+ fakeServer.restore();
+ window.fakeServer = sinon.fakeServer.create();
+
+ // uploader function messes up with fakeServer
+ var uploaderDetectStub = sinon.stub(OC.Uploader.prototype, '_supportAjaxUploadWithProgress');
+ App.initialize($('#preview'));
expect(fakeServer.requests.length).toEqual(1);
expect(fakeServer.requests[0].method).toEqual('PROPFIND');
expect(fakeServer.requests[0].url).toEqual('https://example.com:9876/owncloud/public.php/webdav/subdir');
expect(fakeServer.requests[0].requestHeaders.Authorization).toEqual('Basic c2g0dG9rOm51bGw=');
+ uploaderDetectStub.restore();
});
describe('Download Url', function() {
@@ -118,5 +126,20 @@ describe('OCA.Sharing.PublicApp tests', function() {
.toEqual(OC.webroot + '/index.php/apps/files_sharing/ajax/test.php?a=1&b=x%20y&t=sh4tok');
});
});
+ describe('Upload Url', function() {
+ var fileList;
+
+ beforeEach(function() {
+ fileList = App.fileList;
+ });
+ it('returns correct upload URL', function() {
+ expect(fileList.getUploadUrl('some file.txt'))
+ .toEqual('/owncloud/public.php/webdav/subdir/some%20file.txt');
+ });
+ it('returns correct upload URL with specified dir', function() {
+ expect(fileList.getUploadUrl('some file.txt', 'sub'))
+ .toEqual('/owncloud/public.php/webdav/sub/some%20file.txt');
+ });
+ });
});
});