diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-07-04 14:08:48 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-04 16:20:27 +0200 |
commit | 4fe1cdd2a7a1930d8ca0cb5bc23e5bfa22be6e55 (patch) | |
tree | babd66d6a90c887c7bc6f97162b7b27156e608ec /apps/files/tests | |
parent | 2327d41b11e11ca0553c829b5d7adeb0f000a474 (diff) | |
download | nextcloud-server-4fe1cdd2a7a1930d8ca0cb5bc23e5bfa22be6e55.tar.gz nextcloud-server-4fe1cdd2a7a1930d8ca0cb5bc23e5bfa22be6e55.zip |
Add machine readable error messages to OC\JSON
Reload the files app in case of authentication errors, expired tokens or disabled app
Reloading will triger the full server side handeling of those errors
formatting
fix missing semicolon + some jshint warnings
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 713cd5468d8..ae22ae0123e 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -1933,4 +1933,30 @@ describe('OCA.Files.FileList tests', function() { }); }); }); + describe('Handeling errors', function () { + beforeEach(function () { + redirectStub = sinon.stub(OC, 'redirect'); + + fileList = new OCA.Files.FileList($('#app-content-files')); + }); + afterEach(function () { + fileList = undefined; + + redirectStub.restore(); + }); + it('reloads the page on authentication errors', function () { + fileList.reload(); + fakeServer.requests[0].respond( + 200, + { 'Content-Type': 'application/json' }, + JSON.stringify({ + status: 'error', + data: { + 'error': 'authentication_error' + } + }) + ); + expect(redirectStub.calledWith(OC.generateUrl('apps/files'))).toEqual(true); + }); + }); }); |