summaryrefslogtreecommitdiffstats
path: root/core/js/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-08-08 16:37:14 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2017-11-13 12:19:14 +0100
commitdfc91a253c19746b1062189740242c5b1992c7a5 (patch)
tree13c291ae491edc398d2458d46b7f7ad4fc830dfa /core/js/tests
parent1a2f9fe678fce329c37b69df47164a2eddead8f1 (diff)
downloadnextcloud-server-dfc91a253c19746b1062189740242c5b1992c7a5.tar.gz
nextcloud-server-dfc91a253c19746b1062189740242c5b1992c7a5.zip
Parse Sabre Exception in OC.Files.Client and file-upload
In case of error, instead of a generic error message, an upload will display whichever message is returned in the Sabre Exception, if applicable. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js/tests')
-rw-r--r--core/js/tests/specs/files/clientSpec.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/core/js/tests/specs/files/clientSpec.js b/core/js/tests/specs/files/clientSpec.js
index d66c209bca5..89ac3e4dd04 100644
--- a/core/js/tests/specs/files/clientSpec.js
+++ b/core/js/tests/specs/files/clientSpec.js
@@ -87,14 +87,28 @@ describe('OC.Files.Client tests', function() {
promise.done(successHandler);
promise.fail(failHandler);
+ var errorXml =
+ '<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">' +
+ ' <s:exception>Sabre\\DAV\\Exception\\SomeException</s:exception>' +
+ ' <s:message>Some error message</s:message>' +
+ '</d:error>';
+
+ var parser = new DOMParser();
+
requestDeferred.resolve({
status: status,
- body: ''
+ body: errorXml,
+ xhr: {
+ responseXML: parser.parseFromString(errorXml, 'application/xml')
+ }
});
promise.then(function() {
expect(failHandler.calledOnce).toEqual(true);
- expect(failHandler.calledWith(status)).toEqual(true);
+ expect(failHandler.getCall(0).args[0]).toEqual(status);
+ expect(failHandler.getCall(0).args[1].status).toEqual(status);
+ expect(failHandler.getCall(0).args[1].message).toEqual('Some error message');
+ expect(failHandler.getCall(0).args[1].exception).toEqual('Sabre\\DAV\\Exception\\SomeException');
expect(successHandler.notCalled).toEqual(true);
});