mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-11-22 11:01:00 +01:00
Note by muxator: This commit introduced a copied & modified version of the testing files loadSettings.js and pad.js. It's Christmas night, and we want to shipt this feature, so I merged it anyway, adding a note in both the original and copied files so that hopefully someone in the distant future is going to merge them back again.
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
/*
|
|
* ACHTUNG: this file was copied & modified from the analogous
|
|
* <basedir>/tests/backend/specs/api/pad.js
|
|
*
|
|
* TODO: unify those two files, and merge in a single one.
|
|
*/
|
|
|
|
const supertest = require(__dirname+'/../../../../src/node_modules/supertest');
|
|
const settings = require(__dirname+'/../../loadSettings').loadSettings();
|
|
const api = supertest('http://'+settings.ip+":"+settings.port);
|
|
|
|
var apiVersion = 1;
|
|
|
|
describe('Connectivity', function(){
|
|
it('can connect', function(done) {
|
|
api.get('/api/')
|
|
.expect('Content-Type', /json/)
|
|
.expect(200, done)
|
|
});
|
|
})
|
|
|
|
describe('API Versioning', function(){
|
|
it('finds the version tag', function(done) {
|
|
api.get('/api/')
|
|
.expect(function(res){
|
|
if (!res.body.currentVersion) throw new Error("No version set in API");
|
|
return;
|
|
})
|
|
.expect(200, done)
|
|
});
|
|
})
|
|
|
|
describe('Permission', function(){
|
|
it('errors with invalid APIKey', function(done) {
|
|
api.get('/api/'+apiVersion+'/createPad?apikey=wrong_password&padID=test')
|
|
.expect(401, done)
|
|
});
|
|
})
|