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.
This commit is contained in:
Richard Hansen 2020-09-24 19:28:32 -04:00 committed by John McLear
parent c148e673a8
commit 1c3c5b744c

View file

@ -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 -- <ul class="bullet"></li><ul class="bullet"></ul></li></ul>
@ -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();