From 1c3c5b744cff66ac6d1906770d032fc838ba8349 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 24 Sep 2020 19:28:32 -0400 Subject: [PATCH] tests: Skip all import/export tests if `!allowAnyoneToImport` Three of the four tests fail if `settings.allowAnyoneToImport` is false. The fourth ("tries to import Plain Text to a pad that does not exist") isn't particularly useful when `settings.allowAnyoneToImport` is false: That test tests an import failure mode, and when `settings.allowAnyoneToImport` is false the failure could be caused by that instead of the expected cause. --- tests/backend/specs/api/importexportGetPost.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/backend/specs/api/importexportGetPost.js b/tests/backend/specs/api/importexportGetPost.js index 831266ec0..e372a9a85 100644 --- a/tests/backend/specs/api/importexportGetPost.js +++ b/tests/backend/specs/api/importexportGetPost.js @@ -311,6 +311,7 @@ describe('Imports and Exports', function(){ }); it('exports Etherpad', function(done) { + if (!settings.allowAnyoneToImport) { this.skip(); return done(); } request(host + '/p/'+testPadId+'/export/etherpad', function (err, res, body) { // TODO: At some point checking that the contents is correct would be suitable if(body.indexOf("hello") !== -1){ @@ -323,6 +324,7 @@ describe('Imports and Exports', function(){ }) it('exports HTML for this Etherpad file', function(done) { + if (!settings.allowAnyoneToImport) { this.skip(); return done(); } request(host + '/p/'+testPadId+'/export/html', function (err, res, body) { // broken pre fix export -- @@ -338,6 +340,7 @@ describe('Imports and Exports', function(){ }) it('tries to import Plain Text to a pad that does not exist', function(done) { + if (!settings.allowAnyoneToImport) { this.skip(); return done(); } var req = request.post(host + '/p/'+testPadId+testPadId+testPadId+'/import', function (err, res, body) { if (res.statusCode === 200) { throw new Error("Was able to import to a pad that doesn't exist"); @@ -360,6 +363,7 @@ describe('Imports and Exports', function(){ }); it('Tries to import unsupported file type', function(done) { + if (!settings.allowAnyoneToImport) { this.skip(); return done(); } if(settings.allowUnknownFileEnds === true){ console.log("allowing unknown file ends so skipping this test"); this.skip();