2017-06-26 00:21:33 +00:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.activate should activate a suspended user 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"data": Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
2019-06-23 22:49:45 +00:00
|
|
|
"createdAt": "2018-01-02T00:00:00.000Z",
|
2018-03-04 23:38:51 +00:00
|
|
|
"email": "user1@example.com",
|
|
|
|
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
|
|
|
"isAdmin": false,
|
|
|
|
"isSuspended": false,
|
|
|
|
"name": "User 1",
|
|
|
|
},
|
|
|
|
"ok": true,
|
|
|
|
"status": 200,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.activate should require admin 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"error": "admin_required",
|
|
|
|
"message": "An admin role is required to access this resource",
|
|
|
|
"ok": false,
|
|
|
|
"status": 403,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.delete should require authentication 1`] = `
|
2018-07-07 22:38:22 +00:00
|
|
|
Object {
|
|
|
|
"error": "authentication_required",
|
|
|
|
"message": "Authentication required",
|
|
|
|
"ok": false,
|
|
|
|
"status": 401,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.demote should demote an admin 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"data": Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
2019-06-23 22:49:45 +00:00
|
|
|
"createdAt": "2018-01-02T00:00:00.000Z",
|
2018-03-04 23:38:51 +00:00
|
|
|
"email": "user1@example.com",
|
|
|
|
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
|
|
|
"isAdmin": false,
|
|
|
|
"isSuspended": false,
|
|
|
|
"name": "User 1",
|
|
|
|
},
|
|
|
|
"ok": true,
|
|
|
|
"status": 200,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.demote should require admin 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"error": "admin_required",
|
|
|
|
"message": "An admin role is required to access this resource",
|
|
|
|
"ok": false,
|
|
|
|
"status": 403,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.demote shouldn't demote admins if only one available 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"error": "validation_error",
|
|
|
|
"message": "At least one admin is required",
|
|
|
|
"ok": false,
|
|
|
|
"status": 400,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.list should require admin for detailed info 1`] = `
|
|
|
|
Object {
|
|
|
|
"data": Array [
|
|
|
|
Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
2019-06-23 22:49:45 +00:00
|
|
|
"createdAt": "2018-01-02T00:00:00.000Z",
|
|
|
|
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
|
|
|
"isAdmin": false,
|
2019-01-13 03:41:45 +00:00
|
|
|
"isSuspended": false,
|
2019-06-23 22:49:45 +00:00
|
|
|
"name": "User 1",
|
2018-12-05 06:24:30 +00:00
|
|
|
},
|
|
|
|
Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
|
|
|
"createdAt": "2018-01-01T00:00:00.000Z",
|
2019-06-23 22:49:45 +00:00
|
|
|
"id": "fa952cff-fa64-4d42-a6ea-6955c9689046",
|
|
|
|
"isAdmin": true,
|
2019-01-13 03:41:45 +00:00
|
|
|
"isSuspended": false,
|
2019-06-23 22:49:45 +00:00
|
|
|
"name": "Admin User",
|
2018-12-05 06:24:30 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
"ok": true,
|
|
|
|
"pagination": Object {
|
|
|
|
"limit": 15,
|
|
|
|
"nextPath": "/api/users.list?limit=15&offset=15",
|
|
|
|
"offset": 0,
|
|
|
|
},
|
|
|
|
"status": 200,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
exports[`#users.list should return teams paginated user list 1`] = `
|
|
|
|
Object {
|
|
|
|
"data": Array [
|
|
|
|
Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
2019-06-23 22:49:45 +00:00
|
|
|
"createdAt": "2018-01-02T00:00:00.000Z",
|
2018-12-05 06:24:30 +00:00
|
|
|
"email": "user1@example.com",
|
|
|
|
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
|
|
|
"isAdmin": false,
|
|
|
|
"isSuspended": false,
|
|
|
|
"name": "User 1",
|
|
|
|
},
|
|
|
|
Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
|
|
|
"createdAt": "2018-01-01T00:00:00.000Z",
|
|
|
|
"email": "admin@example.com",
|
|
|
|
"id": "fa952cff-fa64-4d42-a6ea-6955c9689046",
|
|
|
|
"isAdmin": true,
|
|
|
|
"isSuspended": false,
|
|
|
|
"name": "Admin User",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"ok": true,
|
|
|
|
"pagination": Object {
|
|
|
|
"limit": 15,
|
|
|
|
"nextPath": "/api/users.list?limit=15&offset=15",
|
|
|
|
"offset": 0,
|
|
|
|
},
|
|
|
|
"status": 200,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
exports[`#users.promote should promote a new admin 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"data": Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
2019-06-23 22:49:45 +00:00
|
|
|
"createdAt": "2018-01-02T00:00:00.000Z",
|
2018-03-04 23:38:51 +00:00
|
|
|
"email": "user1@example.com",
|
|
|
|
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
|
|
|
"isAdmin": true,
|
|
|
|
"isSuspended": false,
|
|
|
|
"name": "User 1",
|
|
|
|
},
|
|
|
|
"ok": true,
|
|
|
|
"status": 200,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.promote should require admin 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"error": "admin_required",
|
|
|
|
"message": "An admin role is required to access this resource",
|
|
|
|
"ok": false,
|
|
|
|
"status": 403,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.suspend should require admin 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"error": "admin_required",
|
|
|
|
"message": "An admin role is required to access this resource",
|
|
|
|
"ok": false,
|
|
|
|
"status": 403,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.suspend should suspend an user 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"data": Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
2019-06-23 22:49:45 +00:00
|
|
|
"createdAt": "2018-01-02T00:00:00.000Z",
|
2018-03-04 23:38:51 +00:00
|
|
|
"email": "user1@example.com",
|
|
|
|
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
|
|
|
"isAdmin": false,
|
|
|
|
"isSuspended": true,
|
|
|
|
"name": "User 1",
|
|
|
|
},
|
|
|
|
"ok": true,
|
|
|
|
"status": 200,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.suspend shouldn't allow suspending the user themselves 1`] = `
|
2018-03-04 23:38:51 +00:00
|
|
|
Object {
|
|
|
|
"error": "validation_error",
|
|
|
|
"message": "Unable to suspend the current user",
|
|
|
|
"ok": false,
|
|
|
|
"status": 400,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.update should require authentication 1`] = `
|
2017-12-03 08:00:23 +00:00
|
|
|
Object {
|
|
|
|
"error": "authentication_required",
|
|
|
|
"message": "Authentication required",
|
|
|
|
"ok": false,
|
|
|
|
"status": 401,
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-12-05 06:24:30 +00:00
|
|
|
exports[`#users.update should update user profile information 1`] = `
|
2017-12-03 08:00:23 +00:00
|
|
|
Object {
|
|
|
|
"data": Object {
|
|
|
|
"avatarUrl": "http://example.com/avatar.png",
|
2019-06-23 22:49:45 +00:00
|
|
|
"createdAt": "2018-01-02T00:00:00.000Z",
|
2018-06-01 04:01:06 +00:00
|
|
|
"email": "user1@example.com",
|
2017-12-03 08:00:23 +00:00
|
|
|
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
|
2018-06-01 04:01:06 +00:00
|
|
|
"isAdmin": false,
|
|
|
|
"isSuspended": false,
|
2017-12-03 08:00:23 +00:00
|
|
|
"name": "New name",
|
|
|
|
},
|
|
|
|
"ok": true,
|
|
|
|
"status": 200,
|
|
|
|
}
|
|
|
|
`;
|