Allow DELETE /entities/by-uid/:uid in readonly mode
Signed-off-by: Crevil <bjoern.soerensen@gmail.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user