3 const request = require('supertest')
9 getUsersListPaginationAndSort,
14 // ---------------------- Export functions --------------------
16 function createUser (url, accessToken, username, password, specialStatus, end) {
22 const path = '/api/v1/users'
26 email: username + '@example.com'
31 .set('Accept', 'application/json')
32 .set('Authorization', 'Bearer ' + accessToken)
34 .expect(specialStatus)
38 function getUserInformation (url, accessToken, end) {
39 const path = '/api/v1/users/me'
43 .set('Accept', 'application/json')
44 .set('Authorization', 'Bearer ' + accessToken)
46 .expect('Content-Type', /json/)
50 function getUsersList (url, end) {
51 const path = '/api/v1/users'
55 .set('Accept', 'application/json')
57 .expect('Content-Type', /json/)
61 function getUsersListPaginationAndSort (url, start, count, sort, end) {
62 const path = '/api/v1/users'
66 .query({ start: start })
67 .query({ count: count })
68 .query({ sort: sort })
69 .set('Accept', 'application/json')
71 .expect('Content-Type', /json/)
75 function removeUser (url, userId, accessToken, expectedStatus, end) {
81 const path = '/api/v1/users'
84 .delete(path + '/' + userId)
85 .set('Accept', 'application/json')
86 .set('Authorization', 'Bearer ' + accessToken)
87 .expect(expectedStatus)
91 function updateUser (url, userId, accessToken, newPassword, end) {
92 const path = '/api/v1/users/' + userId
96 .set('Accept', 'application/json')
97 .set('Authorization', 'Bearer ' + accessToken)
98 .send({ password: newPassword })
103 // ---------------------------------------------------------------------------
105 module.exports = usersUtils