Allow DELETE /entities/by-uid/:uid in readonly mode

Signed-off-by: Crevil <bjoern.soerensen@gmail.com>
This commit is contained in:
Crevil
2021-03-25 21:02:54 +01:00
parent ddf37387b2
commit d9638c3e8f
2 changed files with 5 additions and 5 deletions
@@ -440,11 +440,13 @@ describe('createRouter readonly enabled', () => {
});
describe('DELETE /entities/by-uid/:uid', () => {
it('is not allowed', async () => {
// this delete is allowed as there is no other way to remove entities
it('is allowed', async () => {
const response = await request(app).delete('/entities/by-uid/apa');
expect(response.status).toEqual(403);
expect(response.text).toMatch(/not allowed in readonly/);
expect(entitiesCatalog.removeEntityByUid).toHaveBeenCalledTimes(1);
expect(entitiesCatalog.removeEntityByUid).toHaveBeenCalledWith('apa');
expect(response.status).toEqual(204);
});
});
@@ -123,8 +123,6 @@ export async function createRouter(
res.status(200).json(entities[0]);
})
.delete('/entities/by-uid/:uid', async (req, res) => {
disallowReadonlyMode(readonlyEnabled);
const { uid } = req.params;
await entitiesCatalog.removeEntityByUid(uid);
res.status(204).end();