.get(path)
.query({ start: 'hello' })
.set('Accept', 'application/json')
+ .set('Authorization', 'Bearer ' + server.accessToken)
.expect(400)
})
.get(path)
.query({ count: 'hello' })
.set('Accept', 'application/json')
+ .set('Authorization', 'Bearer ' + server.accessToken)
.expect(400)
})
.get(path)
.query({ sort: 'hello' })
.set('Accept', 'application/json')
+ .set('Authorization', 'Bearer ' + server.accessToken)
.expect(400)
})
+
+ it('Should fail with a non authenticated user', async function () {
+ await request(server.url)
+ .get(path)
+ .set('Accept', 'application/json')
+ .expect(401)
+ })
+
+ it('Should fail with a non admin user', async function () {
+ await request(server.url)
+ .get(path)
+ .set('Accept', 'application/json')
+ .set('Authorization', 'Bearer ' + userAccessToken)
+ .expect(403)
+ })
})
describe('When adding a new user', function () {
describe('When updating a user', function () {
before(async function () {
- const res = await getUsersList(server.url)
+ const res = await getUsersList(server.url, server.accessToken)
userId = res.body.data[1].id
rootId = res.body.data[2].id