tests: Switch import/export tests to self-contained server
This makes it possible to test various settings combinations and examine internal state to confirm correct behavior. Also, the user doesn't need to start an Etherpad server before running these tests.pull/4391/head
parent
32b6d8e37f
commit
2f17849b7b
|
@ -3,12 +3,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const assert = require('assert').strict;
|
const assert = require('assert').strict;
|
||||||
|
const common = require('../../common');
|
||||||
const superagent = require(__dirname+'/../../../../src/node_modules/superagent');
|
const superagent = require(__dirname+'/../../../../src/node_modules/superagent');
|
||||||
const supertest = require(__dirname+'/../../../../src/node_modules/supertest');
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const settings = require(__dirname+'/../../../../src/node/utils/Settings');
|
const settings = require(__dirname+'/../../../../src/node/utils/Settings');
|
||||||
const host = 'http://127.0.0.1:'+settings.port;
|
|
||||||
const agent = supertest(`http://${settings.ip}:${settings.port}`);
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const padText = fs.readFileSync("../tests/backend/specs/api/test.txt");
|
const padText = fs.readFileSync("../tests/backend/specs/api/test.txt");
|
||||||
const etherpadDoc = fs.readFileSync("../tests/backend/specs/api/test.etherpad");
|
const etherpadDoc = fs.readFileSync("../tests/backend/specs/api/test.etherpad");
|
||||||
|
@ -18,11 +16,14 @@ const odtDoc = fs.readFileSync("../tests/backend/specs/api/test.odt");
|
||||||
const pdfDoc = fs.readFileSync("../tests/backend/specs/api/test.pdf");
|
const pdfDoc = fs.readFileSync("../tests/backend/specs/api/test.pdf");
|
||||||
var filePath = path.join(__dirname, '../../../../APIKEY.txt');
|
var filePath = path.join(__dirname, '../../../../APIKEY.txt');
|
||||||
|
|
||||||
|
let agent;
|
||||||
var apiKey = fs.readFileSync(filePath, {encoding: 'utf-8'});
|
var apiKey = fs.readFileSync(filePath, {encoding: 'utf-8'});
|
||||||
apiKey = apiKey.replace(/\n$/, "");
|
apiKey = apiKey.replace(/\n$/, "");
|
||||||
var apiVersion = 1;
|
var apiVersion = 1;
|
||||||
var testPadId = makeid();
|
var testPadId = makeid();
|
||||||
|
|
||||||
|
before(async function() { agent = await common.init(); });
|
||||||
|
|
||||||
describe('Connectivity', function(){
|
describe('Connectivity', function(){
|
||||||
it('can connect', async function() {
|
it('can connect', async function() {
|
||||||
await agent.get('/api/')
|
await agent.get('/api/')
|
||||||
|
|
Loading…
Reference in New Issue