aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-08 15:51:38 +0200
committerChocobozzz <me@florianbigard.com>2018-10-08 15:55:32 +0200
commit24b9417cec5cc785a57b2fe169a1ae88b88801a4 (patch)
tree42adf8fb4355c96fe2585ebd6312563e8182d682 /server/tests/api/users/users.ts
parent791645e620fb98c6e7c32271d91d91ff7e41b892 (diff)
downloadPeerTube-24b9417cec5cc785a57b2fe169a1ae88b88801a4.tar.gz
PeerTube-24b9417cec5cc785a57b2fe169a1ae88b88801a4.tar.zst
PeerTube-24b9417cec5cc785a57b2fe169a1ae88b88801a4.zip
Add users search filter
Diffstat (limited to 'server/tests/api/users/users.ts')
-rw-r--r--server/tests/api/users/users.ts36
1 files changed, 35 insertions, 1 deletions
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 8b9c6b455..513bca8a0 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -180,7 +180,7 @@ describe('Test users', function () {
180 it('Should be able to upload a video again') 180 it('Should be able to upload a video again')
181 181
182 it('Should be able to create a new user', async function () { 182 it('Should be able to create a new user', async function () {
183 await createUser(server.url, accessToken, user.username,user.password, 2 * 1024 * 1024) 183 await createUser(server.url, accessToken, user.username, user.password, 2 * 1024 * 1024)
184 }) 184 })
185 185
186 it('Should be able to login with this user', async function () { 186 it('Should be able to login with this user', async function () {
@@ -322,6 +322,40 @@ describe('Test users', function () {
322 expect(users[ 1 ].nsfwPolicy).to.equal('display') 322 expect(users[ 1 ].nsfwPolicy).to.equal('display')
323 }) 323 })
324 324
325 it('Should search user by username', async function () {
326 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'oot')
327 const users = res.body.data as User[]
328
329 expect(res.body.total).to.equal(1)
330 expect(users.length).to.equal(1)
331
332 expect(users[ 0 ].username).to.equal('root')
333 })
334
335 it('Should search user by email', async function () {
336 {
337 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'r_1@exam')
338 const users = res.body.data as User[]
339
340 expect(res.body.total).to.equal(1)
341 expect(users.length).to.equal(1)
342
343 expect(users[ 0 ].username).to.equal('user_1')
344 expect(users[ 0 ].email).to.equal('user_1@example.com')
345 }
346
347 {
348 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'example')
349 const users = res.body.data as User[]
350
351 expect(res.body.total).to.equal(2)
352 expect(users.length).to.equal(2)
353
354 expect(users[ 0 ].username).to.equal('root')
355 expect(users[ 1 ].username).to.equal('user_1')
356 }
357 })
358
325 it('Should update my password', async function () { 359 it('Should update my password', async function () {
326 await updateMyUser({ 360 await updateMyUser({
327 url: server.url, 361 url: server.url,