tests: Delete overly aggressive timeouts

See https://github.com/ether/etherpad-lite/issues/4988 for rationale.
This commit is contained in:
Richard Hansen 2021-08-30 02:02:35 -04:00
parent 67dfb64095
commit 348bc0c269
4 changed files with 0 additions and 91 deletions

View file

@ -142,27 +142,23 @@ describe(__filename, function () {
describe('Normal accesses', function () {
it('!authn anonymous cookie /p/pad -> 200, ok', async function () {
this.timeout(600);
const res = await agent.get('/p/pad').expect(200);
socket = await connect(res);
const clientVars = await handshake(socket, 'pad');
assert.equal(clientVars.type, 'CLIENT_VARS');
});
it('!authn !cookie -> ok', async function () {
this.timeout(400);
socket = await connect(null);
const clientVars = await handshake(socket, 'pad');
assert.equal(clientVars.type, 'CLIENT_VARS');
});
it('!authn user /p/pad -> 200, ok', async function () {
this.timeout(400);
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
const clientVars = await handshake(socket, 'pad');
assert.equal(clientVars.type, 'CLIENT_VARS');
});
it('authn user /p/pad -> 200, ok', async function () {
this.timeout(400);
settings.requireAuthentication = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -173,7 +169,6 @@ describe(__filename, function () {
for (const authn of [false, true]) {
const desc = authn ? 'authn user' : '!authn anonymous';
it(`${desc} read-only /p/pad -> 200, ok`, async function () {
this.timeout(400);
const get = (ep) => {
let res = agent.get(ep);
if (authn) res = res.auth('user', 'user-password');
@ -197,7 +192,6 @@ describe(__filename, function () {
}
it('authz user /p/pad -> 200, ok', async function () {
this.timeout(400);
settings.requireAuthentication = true;
settings.requireAuthorization = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -206,7 +200,6 @@ describe(__filename, function () {
assert.equal(clientVars.type, 'CLIENT_VARS');
});
it('supports pad names with characters that must be percent-encoded', async function () {
this.timeout(400);
settings.requireAuthentication = true;
// requireAuthorization is set to true here to guarantee that the user's padAuthorizations
// object is populated. Technically this isn't necessary because the user's padAuthorizations
@ -223,7 +216,6 @@ describe(__filename, function () {
describe('Abnormal access attempts', function () {
it('authn anonymous /p/pad -> 401, error', async function () {
this.timeout(400);
settings.requireAuthentication = true;
const res = await agent.get('/p/pad').expect(401);
// Despite the 401, try to create the pad via a socket.io connection anyway.
@ -233,7 +225,6 @@ describe(__filename, function () {
});
it('authn anonymous read-only /p/pad -> 401, error', async function () {
this.timeout(400);
settings.requireAuthentication = true;
let res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -250,14 +241,12 @@ describe(__filename, function () {
});
it('authn !cookie -> error', async function () {
this.timeout(400);
settings.requireAuthentication = true;
socket = await connect(null);
const message = await handshake(socket, 'pad');
assert.equal(message.accessStatus, 'deny');
});
it('authorization bypass attempt -> error', async function () {
this.timeout(400);
// Only allowed to access /p/pad.
authorize = (req) => req.path === '/p/pad';
settings.requireAuthentication = true;
@ -278,7 +267,6 @@ describe(__filename, function () {
});
it("level='create' -> can create", async function () {
this.timeout(400);
authorize = () => 'create';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -287,7 +275,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false);
});
it('level=true -> can create', async function () {
this.timeout(400);
authorize = () => true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -296,7 +283,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false);
});
it("level='modify' -> can modify", async function () {
this.timeout(400);
await padManager.getPad('pad'); // Create the pad.
authorize = () => 'modify';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -306,7 +292,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false);
});
it("level='create' settings.editOnly=true -> unable to create", async function () {
this.timeout(400);
authorize = () => 'create';
settings.editOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -315,7 +300,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny');
});
it("level='modify' settings.editOnly=false -> unable to create", async function () {
this.timeout(400);
authorize = () => 'modify';
settings.editOnly = false;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -324,7 +308,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny');
});
it("level='readOnly' -> unable to create", async function () {
this.timeout(400);
authorize = () => 'readOnly';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -332,7 +315,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny');
});
it("level='readOnly' -> unable to modify", async function () {
this.timeout(400);
await padManager.getPad('pad'); // Create the pad.
authorize = () => 'readOnly';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -349,7 +331,6 @@ describe(__filename, function () {
});
it('user.canCreate = true -> can create and modify', async function () {
this.timeout(400);
settings.users.user.canCreate = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -358,7 +339,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false);
});
it('user.canCreate = false -> unable to create', async function () {
this.timeout(400);
settings.users.user.canCreate = false;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -366,7 +346,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny');
});
it('user.readOnly = true -> unable to create', async function () {
this.timeout(400);
settings.users.user.readOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -374,7 +353,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny');
});
it('user.readOnly = true -> unable to modify', async function () {
this.timeout(400);
await padManager.getPad('pad'); // Create the pad.
settings.users.user.readOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -384,7 +362,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, true);
});
it('user.readOnly = false -> can create and modify', async function () {
this.timeout(400);
settings.users.user.readOnly = false;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res);
@ -393,7 +370,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false);
});
it('user.readOnly = true, user.canCreate = true -> unable to create', async function () {
this.timeout(400);
settings.users.user.canCreate = true;
settings.users.user.readOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -410,7 +386,6 @@ describe(__filename, function () {
});
it('authorize hook does not elevate level from user settings', async function () {
this.timeout(400);
settings.users.user.readOnly = true;
authorize = () => 'create';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -419,7 +394,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny');
});
it('user settings does not elevate level from authorize hook', async function () {
this.timeout(400);
settings.users.user.readOnly = false;
settings.users.user.canCreate = true;
authorize = () => 'readOnly';