Added missing done() calls for async tests

remotes/origin/external-backend-ondemand
Vincent Petry 10 years ago
parent bbd5f28415
commit b4cfc79b5a
  1. 51
      core/js/tests/specs/setupchecksSpec.js

@ -10,13 +10,16 @@
describe('OC.SetupChecks tests', function() { describe('OC.SetupChecks tests', function() {
var suite = this; var suite = this;
var protocolStub;
beforeEach( function(){ beforeEach( function(){
protocolStub = sinon.stub(OC, 'getProtocol');
suite.server = sinon.fakeServer.create(); suite.server = sinon.fakeServer.create();
}); });
afterEach( function(){ afterEach( function(){
suite.server.restore(); suite.server.restore();
protocolStub.restore();
}); });
describe('checkWebDAV', function() { describe('checkWebDAV', function() {
@ -27,6 +30,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['Your web server is not yet set up properly to allow file synchronization because the WebDAV interface seems to be broken.']); expect(data).toEqual(['Your web server is not yet set up properly to allow file synchronization because the WebDAV interface seems to be broken.']);
done();
}); });
}); });
@ -37,6 +41,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual([]); expect(data).toEqual([]);
done();
}); });
}); });
@ -47,6 +52,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual([]); expect(data).toEqual([]);
done();
}); });
}); });
}); });
@ -65,6 +71,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.']); expect(data).toEqual(['This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.']);
done();
}); });
}); });
@ -81,6 +88,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.']); expect(data).toEqual(['This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.']);
done();
}); });
}); });
@ -97,6 +105,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['Error occurred while checking server setup']); expect(data).toEqual(['Error occurred while checking server setup']);
done();
}); });
}); });
}); });
@ -114,11 +123,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['Error occurred while checking server setup', 'Error occurred while checking server setup']); expect(data).toEqual(['Error occurred while checking server setup', 'Error occurred while checking server setup']);
done();
}); });
}); });
it('should return all errors if all headers are missing', function(done) { it('should return all errors if all headers are missing', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond( suite.server.requests[0].respond(
@ -131,12 +141,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['The "X-XSS-Protection" HTTP header is not configured to equal to "1; mode=block". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Content-Type-Options" HTTP header is not configured to equal to "nosniff". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Robots-Tag" HTTP header is not configured to equal to "none". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Frame-Options" HTTP header is not configured to equal to "SAMEORIGIN". This is a potential security risk and we recommend adjusting this setting.']); expect(data).toEqual(['The "X-XSS-Protection" HTTP header is not configured to equal to "1; mode=block". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Content-Type-Options" HTTP header is not configured to equal to "nosniff". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Robots-Tag" HTTP header is not configured to equal to "none". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Frame-Options" HTTP header is not configured to equal to "SAMEORIGIN". This is a potential security risk and we recommend adjusting this setting.']);
done();
}); });
protocolStub.restore();
}); });
it('should return only some errors if just some headers are missing', function(done) { it('should return only some errors if just some headers are missing', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond( suite.server.requests[0].respond(
@ -151,12 +161,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['The "X-XSS-Protection" HTTP header is not configured to equal to "1; mode=block". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Content-Type-Options" HTTP header is not configured to equal to "nosniff". This is a potential security risk and we recommend adjusting this setting.']); expect(data).toEqual(['The "X-XSS-Protection" HTTP header is not configured to equal to "1; mode=block". This is a potential security risk and we recommend adjusting this setting.', 'The "X-Content-Type-Options" HTTP header is not configured to equal to "nosniff". This is a potential security risk and we recommend adjusting this setting.']);
done();
}); });
protocolStub.restore();
}); });
it('should return none errors if all headers are there', function(done) { it('should return none errors if all headers are there', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond( suite.server.requests[0].respond(
@ -172,13 +182,13 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual([]); expect(data).toEqual([]);
done();
}); });
protocolStub.restore();
}); });
}); });
it('should return a SSL warning if HTTPS is not used', function(done) { it('should return a SSL warning if HTTPS is not used', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('http'); protocolStub.returns('http');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond(200, suite.server.requests[0].respond(200,
@ -192,8 +202,8 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['You are accessing this site via HTTP. We strongly suggest you configure your server to require using HTTPS instead.']); expect(data).toEqual(['You are accessing this site via HTTP. We strongly suggest you configure your server to require using HTTPS instead.']);
done();
}); });
protocolStub.restore();
}); });
it('should return an error if the response has no statuscode 200', function(done) { it('should return an error if the response has no statuscode 200', function(done) {
@ -208,11 +218,12 @@ describe('OC.SetupChecks tests', function() {
); );
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['Error occurred while checking server setup', 'Error occurred while checking server setup']); expect(data).toEqual(['Error occurred while checking server setup', 'Error occurred while checking server setup']);
done();
}); });
}); });
it('should return a SSL warning if SSL used without Strict-Transport-Security-Header', function(done) { it('should return a SSL warning if SSL used without Strict-Transport-Security-Header', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond(200, suite.server.requests[0].respond(200,
@ -226,12 +237,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['The "Strict-Transport-Security" HTTP header is not configured to least "2,678,400" seconds. This is a potential security risk and we recommend adjusting this setting.']); expect(data).toEqual(['The "Strict-Transport-Security" HTTP header is not configured to least "2,678,400" seconds. This is a potential security risk and we recommend adjusting this setting.']);
done();
}); });
protocolStub.restore();
}); });
it('should return a SSL warning if SSL used with to small Strict-Transport-Security-Header', function(done) { it('should return a SSL warning if SSL used with to small Strict-Transport-Security-Header', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond(200, suite.server.requests[0].respond(200,
@ -246,12 +257,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['The "Strict-Transport-Security" HTTP header is not configured to least "2,678,400" seconds. This is a potential security risk and we recommend adjusting this setting.']); expect(data).toEqual(['The "Strict-Transport-Security" HTTP header is not configured to least "2,678,400" seconds. This is a potential security risk and we recommend adjusting this setting.']);
done();
}); });
protocolStub.restore();
}); });
it('should return a SSL warning if SSL used with to a bogus Strict-Transport-Security-Header', function(done) { it('should return a SSL warning if SSL used with to a bogus Strict-Transport-Security-Header', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond(200, suite.server.requests[0].respond(200,
@ -266,12 +277,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual(['The "Strict-Transport-Security" HTTP header is not configured to least "2,678,400" seconds. This is a potential security risk and we recommend adjusting this setting.']); expect(data).toEqual(['The "Strict-Transport-Security" HTTP header is not configured to least "2,678,400" seconds. This is a potential security risk and we recommend adjusting this setting.']);
done();
}); });
protocolStub.restore();
}); });
it('should return no SSL warning if SSL used with to exact the minimum Strict-Transport-Security-Header', function(done) { it('should return no SSL warning if SSL used with to exact the minimum Strict-Transport-Security-Header', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond(200, { suite.server.requests[0].respond(200, {
@ -284,12 +295,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual([]); expect(data).toEqual([]);
done();
}); });
protocolStub.restore();
}); });
it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header', function(done) { it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond(200, { suite.server.requests[0].respond(200, {
@ -302,12 +313,12 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual([]); expect(data).toEqual([]);
done();
}); });
protocolStub.restore();
}); });
it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header and includeSubDomains parameter', function(done) { it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header and includeSubDomains parameter', function(done) {
var protocolStub = sinon.stub(OC, 'getProtocol').returns('https'); protocolStub.returns('https');
var async = OC.SetupChecks.checkGeneric(); var async = OC.SetupChecks.checkGeneric();
suite.server.requests[0].respond(200, { suite.server.requests[0].respond(200, {
@ -320,7 +331,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){ async.done(function( data, s, x ){
expect(data).toEqual([]); expect(data).toEqual([]);
done();
}); });
protocolStub.restore();
}); });
}); });

Loading…
Cancel
Save