diff options
Diffstat (limited to 'server/tests/api/users')
-rw-r--r-- | server/tests/api/users/users.ts | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index cad954fcb..0a66bd1ce 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -819,12 +819,12 @@ describe('Test users', function () { | |||
819 | describe('User blocking', function () { | 819 | describe('User blocking', function () { |
820 | let user16Id | 820 | let user16Id |
821 | let user16AccessToken | 821 | let user16AccessToken |
822 | const user16 = { | ||
823 | username: 'user_16', | ||
824 | password: 'my super password' | ||
825 | } | ||
822 | 826 | ||
823 | it('Should block and unblock a user', async function () { | 827 | it('Should block a user', async function () { |
824 | const user16 = { | ||
825 | username: 'user_16', | ||
826 | password: 'my super password' | ||
827 | } | ||
828 | const resUser = await createUser({ | 828 | const resUser = await createUser({ |
829 | url: server.url, | 829 | url: server.url, |
830 | accessToken: server.accessToken, | 830 | accessToken: server.accessToken, |
@@ -840,7 +840,31 @@ describe('Test users', function () { | |||
840 | 840 | ||
841 | await getMyUserInformation(server.url, user16AccessToken, 401) | 841 | await getMyUserInformation(server.url, user16AccessToken, 401) |
842 | await userLogin(server, user16, 400) | 842 | await userLogin(server, user16, 400) |
843 | }) | ||
844 | |||
845 | it('Should search user by banned status', async function () { | ||
846 | { | ||
847 | const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', undefined, true) | ||
848 | const users = res.body.data as User[] | ||
849 | |||
850 | expect(res.body.total).to.equal(1) | ||
851 | expect(users.length).to.equal(1) | ||
852 | |||
853 | expect(users[0].username).to.equal(user16.username) | ||
854 | } | ||
855 | |||
856 | { | ||
857 | const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', undefined, false) | ||
858 | const users = res.body.data as User[] | ||
859 | |||
860 | expect(res.body.total).to.equal(1) | ||
861 | expect(users.length).to.equal(1) | ||
862 | |||
863 | expect(users[0].username).to.not.equal(user16.username) | ||
864 | } | ||
865 | }) | ||
843 | 866 | ||
867 | it('Should unblock a user', async function () { | ||
844 | await unblockUser(server.url, user16Id, server.accessToken) | 868 | await unblockUser(server.url, user16Id, server.accessToken) |
845 | user16AccessToken = await userLogin(server, user16) | 869 | user16AccessToken = await userLogin(server, user16) |
846 | await getMyUserInformation(server.url, user16AccessToken, 200) | 870 | await getMyUserInformation(server.url, user16AccessToken, 200) |