Fixup user route tests
This commit is contained in:
@@ -164,7 +164,7 @@ describe('Users API', function () {
|
||||
});
|
||||
|
||||
describe('invite', function () {
|
||||
it('reinvite unknown user fails', async function () {
|
||||
it(' unknown user fails', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/randomuserid/create_invite`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({})
|
||||
@@ -173,25 +173,7 @@ describe('Users API', function () {
|
||||
expect(response.statusCode).to.equal(404);
|
||||
});
|
||||
|
||||
it('send invite without creating invite fails succeeds', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/${user.id}/send_invite`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({})
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(409);
|
||||
});
|
||||
|
||||
it('create invite second user succeeds', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/${user.id}/create_invite`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({});
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.body.resetToken).to.be.ok();
|
||||
});
|
||||
|
||||
it('can send invite', async function () {
|
||||
it('sending succeeds', async function () {
|
||||
common.clearMailQueue();
|
||||
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/${user.id}/send_invite`)
|
||||
@@ -434,23 +416,6 @@ describe('Users API', function () {
|
||||
expect(response.statusCode).to.equal(204);
|
||||
});
|
||||
|
||||
it('cannot create invite for admin', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/${owner.id}/create_invite`)
|
||||
.query({ access_token: user.token })
|
||||
.ok(() => true);
|
||||
|
||||
expect(response.statusCode).to.equal(403);
|
||||
});
|
||||
|
||||
it('can create invite for another user', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/${user2.id}/create_invite`)
|
||||
.query({ access_token: user.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.body.resetToken).to.be.a('string');
|
||||
expect(response.body.inviteLink).to.be.a('string');
|
||||
});
|
||||
|
||||
it('cannot change admin bit of another', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/users/${owner.id}`)
|
||||
.query({ access_token: user.token })
|
||||
|
||||
Reference in New Issue
Block a user