make the tests work
This commit is contained in:
@@ -63,10 +63,10 @@ async function updateMembers(req, res, next) {
|
||||
}
|
||||
|
||||
async function list(req, res, next) {
|
||||
const [error, groups] = await safe(groups.getAllWithMembers());
|
||||
const [error, result] = await safe(groups.listWithMembers());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { groups }));
|
||||
next(new HttpSuccess(200, { groups: result }));
|
||||
}
|
||||
|
||||
async function remove(req, res, next) {
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('Volumes API', function () {
|
||||
it('cannot create volume with bad name', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/volumes`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ name: 'music#/ ', hostPath: '/media/cloudron-test-music', mountType: 'noop', mountOptions: {} })
|
||||
.send({ name: 'music#/ ', hostPath: '/media/cloudron-test-music', mountType: 'filesystem', mountOptions: {} })
|
||||
.ok(() => true);
|
||||
expect(response.statusCode).to.equal(400);
|
||||
});
|
||||
@@ -27,7 +27,7 @@ describe('Volumes API', function () {
|
||||
it('cannot create volume with bad path', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/volumes`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ name: 'music', hostPath: '/tmp/music', mountType: 'noop', mountOptions: {} })
|
||||
.send({ name: 'music', hostPath: '/tmp/music', mountType: 'filesystem', mountOptions: {} })
|
||||
.ok(() => true);
|
||||
expect(response.statusCode).to.equal(400);
|
||||
});
|
||||
@@ -35,7 +35,7 @@ describe('Volumes API', function () {
|
||||
it('can create volume', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/volumes`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ name: 'music', hostPath: '/media/cloudron-test-music', mountType: 'noop', mountOptions: {} })
|
||||
.send({ name: 'music', hostPath: '/media/cloudron-test-music', mountType: 'filesystem', mountOptions: {} })
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.status).to.equal(201);
|
||||
|
||||
@@ -124,7 +124,7 @@ async function del(req, res, next) {
|
||||
if (req.user.id === req.resource.id) return next(new HttpError(409, 'Not allowed to remove yourself.'));
|
||||
if (users.compareRoles(req.user.role, req.resource.role) < 0) return next(new HttpError(403, `role '${req.resource.role}' is required but user has only '${req.user.role}'`));
|
||||
|
||||
const [error] = await safe(users.remove(req.resource, auditSource.fromRequest(req)));
|
||||
const [error] = await safe(users.del(req.resource, auditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
|
||||
Reference in New Issue
Block a user