1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import * as chai from 'chai'
5 import { MyUser, User, UserRole, Video, VideoAbuseState, VideoAbuseUpdate, VideoPlaylistType } from '../../../../shared/index'
14 getBlacklistedVideosList,
17 getMyUserVideoQuotaUsed,
21 getUsersListPaginationAndSort,
29 registerUserWithChannel,
36 updateCustomSubConfig,
44 } from '../../../../shared/extra-utils'
45 import { follow } from '../../../../shared/extra-utils/server/follows'
46 import { logout, serverLogin, setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
47 import { getMyVideos } from '../../../../shared/extra-utils/videos/videos'
48 import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
49 import { CustomConfig } from '@shared/models/server'
51 const expect = chai.expect
53 describe('Test users', function () {
54 let server: ServerInfo
55 let accessToken: string
56 let accessTokenUser: string
61 password: 'super password'
64 before(async function () {
67 server = await flushAndRunServer(1, {
75 await setAccessTokensToServers([ server ])
77 await installPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-theme-background-red' })
80 describe('OAuth client', function () {
81 it('Should create a new client')
83 it('Should return the first client')
85 it('Should remove the last client')
87 it('Should not login with an invalid client id', async function () {
88 const client = { id: 'client', secret: server.client.secret }
89 const res = await login(server.url, client, server.user, 400)
91 expect(res.body.error).to.contain('client is invalid')
94 it('Should not login with an invalid client secret', async function () {
95 const client = { id: server.client.id, secret: 'coucou' }
96 const res = await login(server.url, client, server.user, 400)
98 expect(res.body.error).to.contain('client is invalid')
102 describe('Login', function () {
104 it('Should not login with an invalid username', async function () {
105 const user = { username: 'captain crochet', password: server.user.password }
106 const res = await login(server.url, server.client, user, 400)
108 expect(res.body.error).to.contain('credentials are invalid')
111 it('Should not login with an invalid password', async function () {
112 const user = { username: server.user.username, password: 'mew_three' }
113 const res = await login(server.url, server.client, user, 400)
115 expect(res.body.error).to.contain('credentials are invalid')
118 it('Should not be able to upload a video', async function () {
119 accessToken = 'my_super_token'
121 const videoAttributes = {}
122 await uploadVideo(server.url, accessToken, videoAttributes, 401)
125 it('Should not be able to follow', async function () {
126 accessToken = 'my_super_token'
127 await follow(server.url, [ 'http://example.com' ], accessToken, 401)
130 it('Should not be able to unfollow')
132 it('Should be able to login', async function () {
133 const res = await login(server.url, server.client, server.user, 200)
135 accessToken = res.body.access_token
138 it('Should be able to login with an insensitive username', async function () {
139 const user = { username: 'RoOt', password: server.user.password }
140 await login(server.url, server.client, user, 200)
142 const user2 = { username: 'rOoT', password: server.user.password }
143 await login(server.url, server.client, user2, 200)
145 const user3 = { username: 'ROOt', password: server.user.password }
146 await login(server.url, server.client, user3, 200)
150 describe('Upload', function () {
152 it('Should upload the video with the correct token', async function () {
153 const videoAttributes = {}
154 await uploadVideo(server.url, accessToken, videoAttributes)
155 const res = await getVideosList(server.url)
156 const video = res.body.data[0]
158 expect(video.account.name).to.equal('root')
162 it('Should upload the video again with the correct token', async function () {
163 const videoAttributes = {}
164 await uploadVideo(server.url, accessToken, videoAttributes)
168 describe('Ratings', function () {
170 it('Should retrieve a video rating', async function () {
171 await rateVideo(server.url, accessToken, videoId, 'like')
172 const res = await getMyUserVideoRating(server.url, accessToken, videoId)
173 const rating = res.body
175 expect(rating.videoId).to.equal(videoId)
176 expect(rating.rating).to.equal('like')
179 it('Should retrieve ratings list', async function () {
180 await rateVideo(server.url, accessToken, videoId, 'like')
182 const res = await getAccountRatings(server.url, server.user.username, server.accessToken, null, 200)
183 const ratings = res.body
185 expect(ratings.total).to.equal(1)
186 expect(ratings.data[0].video.id).to.equal(videoId)
187 expect(ratings.data[0].rating).to.equal('like')
190 it('Should retrieve ratings list by rating type', async function () {
192 const res = await getAccountRatings(server.url, server.user.username, server.accessToken, 'like')
193 const ratings = res.body
194 expect(ratings.data.length).to.equal(1)
198 const res = await getAccountRatings(server.url, server.user.username, server.accessToken, 'dislike')
199 const ratings = res.body
200 expect(ratings.data.length).to.equal(0)
205 describe('Remove video', function () {
206 it('Should not be able to remove the video with an incorrect token', async function () {
207 await removeVideo(server.url, 'bad_token', videoId, 401)
210 it('Should not be able to remove the video with the token of another account')
212 it('Should be able to remove the video with the correct token', async function () {
213 await removeVideo(server.url, accessToken, videoId)
217 describe('Logout', function () {
218 it('Should logout (revoke token)', async function () {
219 await logout(server.url, server.accessToken)
222 it('Should not be able to get the user information', async function () {
223 await getMyUserInformation(server.url, server.accessToken, 401)
226 it('Should not be able to upload a video', async function () {
227 await uploadVideo(server.url, server.accessToken, { name: 'video' }, 401)
230 it('Should not be able to rate a video', async function () {
231 const path = '/api/v1/videos/'
238 path: path + videoId,
239 token: 'wrong token',
241 statusCodeExpected: 401
243 await makePutBodyRequest(options)
246 it('Should be able to login again', async function () {
247 server.accessToken = await serverLogin(server)
250 it('Should have an expired access token')
252 it('Should refresh the token')
254 it('Should be able to get my user information again', async function () {
255 await getMyUserInformation(server.url, server.accessToken)
259 describe('Creating a user', function () {
261 it('Should be able to create a new user', async function () {
264 accessToken: accessToken,
265 username: user.username,
266 password: user.password,
267 videoQuota: 2 * 1024 * 1024,
268 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK
272 it('Should be able to login with this user', async function () {
273 accessTokenUser = await userLogin(server, user)
276 it('Should be able to get user information', async function () {
277 const res1 = await getMyUserInformation(server.url, accessTokenUser)
278 const userMe: MyUser = res1.body
280 const res2 = await getUserInformation(server.url, server.accessToken, userMe.id, true)
281 const userGet: User = res2.body
283 for (const user of [ userMe, userGet ]) {
284 expect(user.username).to.equal('user_1')
285 expect(user.email).to.equal('user_1@example.com')
286 expect(user.nsfwPolicy).to.equal('display')
287 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
288 expect(user.roleLabel).to.equal('User')
289 expect(user.id).to.be.a('number')
290 expect(user.account.displayName).to.equal('user_1')
291 expect(user.account.description).to.be.null
294 expect(userMe.adminFlags).to.be.undefined
295 expect(userGet.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLOCK)
297 expect(userMe.specialPlaylists).to.have.lengthOf(1)
298 expect(userMe.specialPlaylists[0].type).to.equal(VideoPlaylistType.WATCH_LATER)
300 // Check stats are included with withStats
301 expect(userGet.videosCount).to.be.a('number')
302 expect(userGet.videosCount).to.equal(0)
303 expect(userGet.videoCommentsCount).to.be.a('number')
304 expect(userGet.videoCommentsCount).to.equal(0)
305 expect(userGet.videoAbusesCount).to.be.a('number')
306 expect(userGet.videoAbusesCount).to.equal(0)
307 expect(userGet.videoAbusesAcceptedCount).to.be.a('number')
308 expect(userGet.videoAbusesAcceptedCount).to.equal(0)
312 describe('My videos & quotas', function () {
314 it('Should be able to upload a video with this user', async function () {
317 const videoAttributes = {
318 name: 'super user video',
319 fixture: 'video_short.webm'
321 await uploadVideo(server.url, accessTokenUser, videoAttributes)
324 it('Should have video quota updated', async function () {
325 const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser)
326 const data = res.body
328 expect(data.videoQuotaUsed).to.equal(218910)
330 const resUsers = await getUsersList(server.url, server.accessToken)
332 const users: User[] = resUsers.body.data
333 const tmpUser = users.find(u => u.username === user.username)
334 expect(tmpUser.videoQuotaUsed).to.equal(218910)
337 it('Should be able to list my videos', async function () {
338 const res = await getMyVideos(server.url, accessTokenUser, 0, 5)
339 expect(res.body.total).to.equal(1)
341 const videos = res.body.data
342 expect(videos).to.have.lengthOf(1)
344 const video: Video = videos[0]
345 expect(video.name).to.equal('super user video')
346 expect(video.thumbnailPath).to.not.be.null
347 expect(video.previewPath).to.not.be.null
350 it('Should be able to search in my videos', async function () {
352 const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'user video')
353 expect(res.body.total).to.equal(1)
355 const videos = res.body.data
356 expect(videos).to.have.lengthOf(1)
360 const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'toto')
361 expect(res.body.total).to.equal(0)
363 const videos = res.body.data
364 expect(videos).to.have.lengthOf(0)
368 it('Should disable webtorrent, enable HLS, and update my quota', async function () {
372 const res = await getCustomConfig(server.url, server.accessToken)
373 const config = res.body as CustomConfig
374 config.transcoding.webtorrent.enabled = false
375 config.transcoding.hls.enabled = true
376 config.transcoding.enabled = true
377 await updateCustomSubConfig(server.url, server.accessToken, config)
381 const videoAttributes = {
382 name: 'super user video 2',
383 fixture: 'video_short.webm'
385 await uploadVideo(server.url, accessTokenUser, videoAttributes)
387 await waitJobs([ server ])
391 const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser)
392 const data = res.body
394 expect(data.videoQuotaUsed).to.be.greaterThan(220000)
399 describe('Users listing', function () {
401 it('Should list all the users', async function () {
402 const res = await getUsersList(server.url, server.accessToken)
403 const result = res.body
404 const total = result.total
405 const users = result.data
407 expect(total).to.equal(2)
408 expect(users).to.be.an('array')
409 expect(users.length).to.equal(2)
411 const user = users[0]
412 expect(user.username).to.equal('user_1')
413 expect(user.email).to.equal('user_1@example.com')
414 expect(user.nsfwPolicy).to.equal('display')
416 const rootUser = users[1]
417 expect(rootUser.username).to.equal('root')
418 expect(rootUser.email).to.equal('admin' + server.internalServerNumber + '@example.com')
419 expect(user.nsfwPolicy).to.equal('display')
421 expect(rootUser.lastLoginDate).to.exist
422 expect(user.lastLoginDate).to.exist
427 it('Should list only the first user by username asc', async function () {
428 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, 'username')
430 const result = res.body
431 const total = result.total
432 const users = result.data
434 expect(total).to.equal(2)
435 expect(users.length).to.equal(1)
437 const user = users[0]
438 expect(user.username).to.equal('root')
439 expect(user.email).to.equal('admin' + server.internalServerNumber + '@example.com')
440 expect(user.roleLabel).to.equal('Administrator')
441 expect(user.nsfwPolicy).to.equal('display')
444 it('Should list only the first user by username desc', async function () {
445 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-username')
446 const result = res.body
447 const total = result.total
448 const users = result.data
450 expect(total).to.equal(2)
451 expect(users.length).to.equal(1)
453 const user = users[0]
454 expect(user.username).to.equal('user_1')
455 expect(user.email).to.equal('user_1@example.com')
456 expect(user.nsfwPolicy).to.equal('display')
459 it('Should list only the second user by createdAt desc', async function () {
460 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-createdAt')
461 const result = res.body
462 const total = result.total
463 const users = result.data
465 expect(total).to.equal(2)
466 expect(users.length).to.equal(1)
468 const user = users[0]
469 expect(user.username).to.equal('user_1')
470 expect(user.email).to.equal('user_1@example.com')
471 expect(user.nsfwPolicy).to.equal('display')
474 it('Should list all the users by createdAt asc', async function () {
475 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt')
476 const result = res.body
477 const total = result.total
478 const users = result.data
480 expect(total).to.equal(2)
481 expect(users.length).to.equal(2)
483 expect(users[0].username).to.equal('root')
484 expect(users[0].email).to.equal('admin' + server.internalServerNumber + '@example.com')
485 expect(users[0].nsfwPolicy).to.equal('display')
487 expect(users[1].username).to.equal('user_1')
488 expect(users[1].email).to.equal('user_1@example.com')
489 expect(users[1].nsfwPolicy).to.equal('display')
492 it('Should search user by username', async function () {
493 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'oot')
494 const users = res.body.data as User[]
496 expect(res.body.total).to.equal(1)
497 expect(users.length).to.equal(1)
499 expect(users[0].username).to.equal('root')
502 it('Should search user by email', async function () {
504 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'r_1@exam')
505 const users = res.body.data as User[]
507 expect(res.body.total).to.equal(1)
508 expect(users.length).to.equal(1)
510 expect(users[0].username).to.equal('user_1')
511 expect(users[0].email).to.equal('user_1@example.com')
515 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'example')
516 const users = res.body.data as User[]
518 expect(res.body.total).to.equal(2)
519 expect(users.length).to.equal(2)
521 expect(users[0].username).to.equal('root')
522 expect(users[1].username).to.equal('user_1')
527 describe('Update my account', function () {
528 it('Should update my password', async function () {
531 accessToken: accessTokenUser,
532 currentPassword: 'super password',
533 password: 'new password'
535 user.password = 'new password'
537 await userLogin(server, user, 200)
540 it('Should be able to change the NSFW display attribute', async function () {
543 accessToken: accessTokenUser,
544 nsfwPolicy: 'do_not_list'
547 const res = await getMyUserInformation(server.url, accessTokenUser)
548 const user = res.body
550 expect(user.username).to.equal('user_1')
551 expect(user.email).to.equal('user_1@example.com')
552 expect(user.nsfwPolicy).to.equal('do_not_list')
553 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
554 expect(user.id).to.be.a('number')
555 expect(user.account.displayName).to.equal('user_1')
556 expect(user.account.description).to.be.null
559 it('Should be able to change the autoPlayVideo attribute', async function () {
562 accessToken: accessTokenUser,
566 const res = await getMyUserInformation(server.url, accessTokenUser)
567 const user = res.body
569 expect(user.autoPlayVideo).to.be.false
572 it('Should be able to change the autoPlayNextVideo attribute', async function () {
575 accessToken: accessTokenUser,
576 autoPlayNextVideo: true
579 const res = await getMyUserInformation(server.url, accessTokenUser)
580 const user = res.body
582 expect(user.autoPlayNextVideo).to.be.true
585 it('Should be able to change the email attribute', async function () {
588 accessToken: accessTokenUser,
589 currentPassword: 'new password',
590 email: 'updated@example.com'
593 const res = await getMyUserInformation(server.url, accessTokenUser)
594 const user = res.body
596 expect(user.username).to.equal('user_1')
597 expect(user.email).to.equal('updated@example.com')
598 expect(user.nsfwPolicy).to.equal('do_not_list')
599 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
600 expect(user.id).to.be.a('number')
601 expect(user.account.displayName).to.equal('user_1')
602 expect(user.account.description).to.be.null
605 it('Should be able to update my avatar', async function () {
606 const fixture = 'avatar.png'
608 await updateMyAvatar({
610 accessToken: accessTokenUser,
614 const res = await getMyUserInformation(server.url, accessTokenUser)
615 const user = res.body
617 await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png')
620 it('Should be able to update my display name', async function () {
623 accessToken: accessTokenUser,
624 displayName: 'new display name'
627 const res = await getMyUserInformation(server.url, accessTokenUser)
628 const user = res.body
630 expect(user.username).to.equal('user_1')
631 expect(user.email).to.equal('updated@example.com')
632 expect(user.nsfwPolicy).to.equal('do_not_list')
633 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
634 expect(user.id).to.be.a('number')
635 expect(user.account.displayName).to.equal('new display name')
636 expect(user.account.description).to.be.null
639 it('Should be able to update my description', async function () {
642 accessToken: accessTokenUser,
643 description: 'my super description updated'
646 const res = await getMyUserInformation(server.url, accessTokenUser)
647 const user: User = res.body
649 expect(user.username).to.equal('user_1')
650 expect(user.email).to.equal('updated@example.com')
651 expect(user.nsfwPolicy).to.equal('do_not_list')
652 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
653 expect(user.id).to.be.a('number')
654 expect(user.account.displayName).to.equal('new display name')
655 expect(user.account.description).to.equal('my super description updated')
656 expect(user.noWelcomeModal).to.be.false
657 expect(user.noInstanceConfigWarningModal).to.be.false
660 it('Should be able to update my theme', async function () {
661 for (const theme of [ 'background-red', 'default', 'instance-default' ]) {
664 accessToken: accessTokenUser,
668 const res = await getMyUserInformation(server.url, accessTokenUser)
669 const body: User = res.body
671 expect(body.theme).to.equal(theme)
675 it('Should be able to update my modal preferences', async function () {
678 accessToken: accessTokenUser,
679 noInstanceConfigWarningModal: true,
683 const res = await getMyUserInformation(server.url, accessTokenUser)
684 const user: User = res.body
686 expect(user.noWelcomeModal).to.be.true
687 expect(user.noInstanceConfigWarningModal).to.be.true
691 describe('Updating another user', function () {
692 it('Should be able to update another user', async function () {
697 email: 'updated2@example.com',
700 role: UserRole.MODERATOR,
701 adminFlags: UserAdminFlag.NONE
704 const res = await getUserInformation(server.url, accessToken, userId)
705 const user = res.body
707 expect(user.username).to.equal('user_1')
708 expect(user.email).to.equal('updated2@example.com')
709 expect(user.emailVerified).to.be.true
710 expect(user.nsfwPolicy).to.equal('do_not_list')
711 expect(user.videoQuota).to.equal(42)
712 expect(user.roleLabel).to.equal('Moderator')
713 expect(user.id).to.be.a('number')
714 expect(user.adminFlags).to.equal(UserAdminFlag.NONE)
717 it('Should have removed the user token', async function () {
718 await getMyUserVideoQuotaUsed(server.url, accessTokenUser, 401)
720 accessTokenUser = await userLogin(server, user)
723 it('Should be able to update another user password', async function () {
728 password: 'password updated'
731 await getMyUserVideoQuotaUsed(server.url, accessTokenUser, 401)
733 await userLogin(server, user, 400)
735 user.password = 'password updated'
736 accessTokenUser = await userLogin(server, user)
740 describe('Video blacklists', function () {
741 it('Should be able to list video blacklist by a moderator', async function () {
742 await getBlacklistedVideosList({ url: server.url, token: accessTokenUser })
746 describe('Remove a user', function () {
747 it('Should be able to remove this user', async function () {
748 await removeUser(server.url, userId, accessToken)
751 it('Should not be able to login with this user', async function () {
752 await userLogin(server, user, 400)
755 it('Should not have videos of this user', async function () {
756 const res = await getVideosList(server.url)
758 expect(res.body.total).to.equal(1)
760 const video = res.body.data[0]
761 expect(video.account.name).to.equal('root')
765 describe('Registering a new user', function () {
766 let user15AccessToken
768 it('Should register a new user', async function () {
769 const user = { displayName: 'super user 15', username: 'user_15', password: 'my super password' }
770 const channel = { name: 'my_user_15_channel', displayName: 'my channel rocks' }
772 await registerUserWithChannel({ url: server.url, user, channel })
775 it('Should be able to login with this registered user', async function () {
778 password: 'my super password'
781 user15AccessToken = await userLogin(server, user15)
784 it('Should have the correct display name', async function () {
785 const res = await getMyUserInformation(server.url, user15AccessToken)
786 const user: User = res.body
788 expect(user.account.displayName).to.equal('super user 15')
791 it('Should have the correct video quota', async function () {
792 const res = await getMyUserInformation(server.url, user15AccessToken)
793 const user = res.body
795 expect(user.videoQuota).to.equal(5 * 1024 * 1024)
798 it('Should have created the channel', async function () {
799 const res = await getVideoChannel(server.url, 'my_user_15_channel')
801 expect(res.body.displayName).to.equal('my channel rocks')
804 it('Should remove me', async function () {
806 const res = await getUsersList(server.url, server.accessToken)
807 expect(res.body.data.find(u => u.username === 'user_15')).to.not.be.undefined
810 await deleteMe(server.url, user15AccessToken)
813 const res = await getUsersList(server.url, server.accessToken)
814 expect(res.body.data.find(u => u.username === 'user_15')).to.be.undefined
819 describe('User blocking', function () {
821 let user16AccessToken
823 it('Should block and unblock a user', async function () {
826 password: 'my super password'
828 const resUser = await createUser({
830 accessToken: server.accessToken,
831 username: user16.username,
832 password: user16.password
834 user16Id = resUser.body.user.id
836 user16AccessToken = await userLogin(server, user16)
838 await getMyUserInformation(server.url, user16AccessToken, 200)
839 await blockUser(server.url, user16Id, server.accessToken)
841 await getMyUserInformation(server.url, user16AccessToken, 401)
842 await userLogin(server, user16, 400)
844 await unblockUser(server.url, user16Id, server.accessToken)
845 user16AccessToken = await userLogin(server, user16)
846 await getMyUserInformation(server.url, user16AccessToken, 200)
850 describe('User stats', function () {
852 let user17AccessToken
854 it('Should report correct initial statistics about a user', async function () {
857 password: 'my super password'
859 const resUser = await createUser({
861 accessToken: server.accessToken,
862 username: user17.username,
863 password: user17.password
866 user17Id = resUser.body.user.id
867 user17AccessToken = await userLogin(server, user17)
869 const res = await getUserInformation(server.url, server.accessToken, user17Id, true)
870 const user: User = res.body
872 expect(user.videosCount).to.equal(0)
873 expect(user.videoCommentsCount).to.equal(0)
874 expect(user.videoAbusesCount).to.equal(0)
875 expect(user.videoAbusesCreatedCount).to.equal(0)
876 expect(user.videoAbusesAcceptedCount).to.equal(0)
879 it('Should report correct videos count', async function () {
880 const videoAttributes = {
881 name: 'video to test user stats'
883 await uploadVideo(server.url, user17AccessToken, videoAttributes)
884 const res1 = await getVideosList(server.url)
885 videoId = res1.body.data.find(video => video.name === videoAttributes.name).id
887 const res2 = await getUserInformation(server.url, server.accessToken, user17Id, true)
888 const user: User = res2.body
890 expect(user.videosCount).to.equal(1)
893 it('Should report correct video comments for user', async function () {
894 const text = 'super comment'
895 await addVideoCommentThread(server.url, user17AccessToken, videoId, text)
897 const res = await getUserInformation(server.url, server.accessToken, user17Id, true)
898 const user: User = res.body
900 expect(user.videoCommentsCount).to.equal(1)
903 it('Should report correct video abuses counts', async function () {
904 const reason = 'my super bad reason'
905 await reportVideoAbuse(server.url, user17AccessToken, videoId, reason)
907 const res1 = await getVideoAbusesList({ url: server.url, token: server.accessToken })
908 const abuseId = res1.body.data[0].id
910 const res2 = await getUserInformation(server.url, server.accessToken, user17Id, true)
911 const user2: User = res2.body
913 expect(user2.videoAbusesCount).to.equal(1) // number of incriminations
914 expect(user2.videoAbusesCreatedCount).to.equal(1) // number of reports created
916 const body: VideoAbuseUpdate = { state: VideoAbuseState.ACCEPTED }
917 await updateVideoAbuse(server.url, server.accessToken, videoId, abuseId, body)
919 const res3 = await getUserInformation(server.url, server.accessToken, user17Id, true)
920 const user3: User = res3.body
922 expect(user3.videoAbusesAcceptedCount).to.equal(1) // number of reports created accepted
926 after(async function () {
927 await cleanupTests([ server ])