Browse Source

Set error expected by the DAV client for a failed move

A revert triggers a move in the DAV client, and the DAV client expects a
DAV error message to be provided by the server in case of failure; if
no error message is given the client ends trying to get an attribute
from an undefined object and "crashes".

Besides that, if the revert fails the "done" callback of the promise
(the first parameter of "then") is never called, so a "fail" callback
should be used instead.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
tags/v15.0.0beta1
Daniel Calviño Sánchez 5 years ago
parent
commit
661756b02a
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      apps/files_versions/tests/js/versionmodelSpec.js

+ 10
- 2
apps/files_versions/tests/js/versionmodelSpec.js View File

@@ -86,9 +86,17 @@ describe('OCA.Versions.VersionModel', function() {
});

expect(fakeServer.requests.length).toEqual(1);
fakeServer.requests[0].respond(404);
var responseErrorHeaders = {
"Content-Type": "application/xml"
};
var responseErrorBody =
'<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>';
fakeServer.requests[0].respond(404, responseErrorHeaders, responseErrorBody);

promise.then(function() {
promise.fail(function() {
expect(revertEventStub.notCalled).toEqual(true);
expect(successStub.notCalled).toEqual(true);
expect(errorStub.calledOnce).toEqual(true);

Loading…
Cancel
Save