mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
tests: Check import of export of read-only pad ID
This commit is contained in:
parent
b683dc300d
commit
70c16bb1b5
1 changed files with 22 additions and 0 deletions
|
@ -151,6 +151,28 @@ describe(__filename, function () {
|
||||||
it('writable pad ID is not leaked', async function () {
|
it('writable pad ID is not leaked', async function () {
|
||||||
assert(!text.includes(testPadId));
|
assert(!text.includes(testPadId));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('re-import to read-only pad ID gives 403 forbidden', async function () {
|
||||||
|
let req = agent.post(`/p/${readOnlyId}/import`)
|
||||||
|
.attach('file', Buffer.from(text), {
|
||||||
|
filename: `/test.${exportType}`,
|
||||||
|
contentType: 'text/plain',
|
||||||
|
});
|
||||||
|
if (authn) req = req.auth('user', 'user-password');
|
||||||
|
await req.expect(403);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('re-import to read-write pad ID gives 200 OK', async function () {
|
||||||
|
// The new pad ID must differ from testPadId because Etherpad refuses to import
|
||||||
|
// .etherpad files on top of a pad that already has edits.
|
||||||
|
let req = agent.post(`/p/${testPadId}_import/import`)
|
||||||
|
.attach('file', Buffer.from(text), {
|
||||||
|
filename: `/test.${exportType}`,
|
||||||
|
contentType: 'text/plain',
|
||||||
|
});
|
||||||
|
if (authn) req = req.auth('user', 'user-password');
|
||||||
|
await req.expect(200);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue