1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import * as chai from 'chai'
5 import { MyUser, User, UserRole, Video, VideoPlaylistType, VideoAbuseState, VideoAbuseUpdate } from '../../../../shared/index'
13 getBlacklistedVideosList,
15 getMyUserVideoQuotaUsed,
19 getUsersListPaginationAndSort,
26 registerUserWithChannel,
38 addVideoCommentThread,
40 getVideoAbusesList, updateCustomSubConfig, getCustomConfig, waitJobs
41 } from '../../../../shared/extra-utils'
42 import { follow } from '../../../../shared/extra-utils/server/follows'
43 import { setAccessTokensToServers, logout } from '../../../../shared/extra-utils/users/login'
44 import { getMyVideos } from '../../../../shared/extra-utils/videos/videos'
45 import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
46 import { CustomConfig } from '@shared/models/server'
48 const expect = chai.expect
50 describe('Test users', function () {
51 let server: ServerInfo
52 let accessToken: string
53 let accessTokenUser: string
58 password: 'super password'
61 before(async function () {
63 server = await flushAndRunServer(1)
65 await setAccessTokensToServers([ server ])
67 await installPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-theme-background-red' })
70 describe('OAuth client', function () {
71 it('Should create a new client')
73 it('Should return the first client')
75 it('Should remove the last client')
77 it('Should not login with an invalid client id', async function () {
78 const client = { id: 'client', secret: server.client.secret }
79 const res = await login(server.url, client, server.user, 400)
81 expect(res.body.error).to.contain('client is invalid')
84 it('Should not login with an invalid client secret', async function () {
85 const client = { id: server.client.id, secret: 'coucou' }
86 const res = await login(server.url, client, server.user, 400)
88 expect(res.body.error).to.contain('client is invalid')
92 describe('Login', function () {
94 it('Should not login with an invalid username', async function () {
95 const user = { username: 'captain crochet', password: server.user.password }
96 const res = await login(server.url, server.client, user, 400)
98 expect(res.body.error).to.contain('credentials are invalid')
101 it('Should not login with an invalid password', async function () {
102 const user = { username: server.user.username, password: 'mew_three' }
103 const res = await login(server.url, server.client, user, 400)
105 expect(res.body.error).to.contain('credentials are invalid')
108 it('Should not be able to upload a video', async function () {
109 accessToken = 'my_super_token'
111 const videoAttributes = {}
112 await uploadVideo(server.url, accessToken, videoAttributes, 401)
115 it('Should not be able to follow', async function () {
116 accessToken = 'my_super_token'
117 await follow(server.url, [ 'http://example.com' ], accessToken, 401)
120 it('Should not be able to unfollow')
122 it('Should be able to login', async function () {
123 const res = await login(server.url, server.client, server.user, 200)
125 accessToken = res.body.access_token
128 it('Should be able to login with an insensitive username', async function () {
129 const user = { username: 'RoOt', password: server.user.password }
130 await login(server.url, server.client, user, 200)
132 const user2 = { username: 'rOoT', password: server.user.password }
133 await login(server.url, server.client, user2, 200)
135 const user3 = { username: 'ROOt', password: server.user.password }
136 await login(server.url, server.client, user3, 200)
140 describe('Upload', function () {
142 it('Should upload the video with the correct token', async function () {
143 const videoAttributes = {}
144 await uploadVideo(server.url, accessToken, videoAttributes)
145 const res = await getVideosList(server.url)
146 const video = res.body.data[0]
148 expect(video.account.name).to.equal('root')
152 it('Should upload the video again with the correct token', async function () {
153 const videoAttributes = {}
154 await uploadVideo(server.url, accessToken, videoAttributes)
158 describe('Ratings', function () {
160 it('Should retrieve a video rating', async function () {
161 await rateVideo(server.url, accessToken, videoId, 'like')
162 const res = await getMyUserVideoRating(server.url, accessToken, videoId)
163 const rating = res.body
165 expect(rating.videoId).to.equal(videoId)
166 expect(rating.rating).to.equal('like')
169 it('Should retrieve ratings list', async function () {
170 await rateVideo(server.url, accessToken, videoId, 'like')
172 const res = await getAccountRatings(server.url, server.user.username, server.accessToken, null, 200)
173 const ratings = res.body
175 expect(ratings.total).to.equal(1)
176 expect(ratings.data[0].video.id).to.equal(videoId)
177 expect(ratings.data[0].rating).to.equal('like')
180 it('Should retrieve ratings list by rating type', async function () {
182 const res = await getAccountRatings(server.url, server.user.username, server.accessToken, 'like')
183 const ratings = res.body
184 expect(ratings.data.length).to.equal(1)
188 const res = await getAccountRatings(server.url, server.user.username, server.accessToken, 'dislike')
189 const ratings = res.body
190 expect(ratings.data.length).to.equal(0)
195 describe('Remove video', function () {
196 it('Should not be able to remove the video with an incorrect token', async function () {
197 await removeVideo(server.url, 'bad_token', videoId, 401)
200 it('Should not be able to remove the video with the token of another account')
202 it('Should be able to remove the video with the correct token', async function () {
203 await removeVideo(server.url, accessToken, videoId)
207 describe('Logout', function () {
208 it('Should logout (revoke token)', async function () {
209 await logout(server.url, server.accessToken)
212 it('Should not be able to get the user information', async function () {
213 await getMyUserInformation(server.url, server.accessToken, 401)
216 it('Should not be able to upload a video', async function () {
217 await uploadVideo(server.url, server.accessToken, { name: 'video' }, 401)
220 it('Should not be able to remove a video')
222 it('Should not be able to rate a video', async function () {
223 const path = '/api/v1/videos/'
230 path: path + videoId,
231 token: 'wrong token',
233 statusCodeExpected: 401
235 await makePutBodyRequest(options)
238 it('Should be able to login again')
240 it('Should have an expired access token')
242 it('Should refresh the token')
244 it('Should be able to upload a video again')
247 describe('Creating a user', function () {
249 it('Should be able to create a new user', async function () {
252 accessToken: accessToken,
253 username: user.username,
254 password: user.password,
255 videoQuota: 2 * 1024 * 1024,
256 adminFlags: UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST
260 it('Should be able to login with this user', async function () {
261 accessTokenUser = await userLogin(server, user)
264 it('Should be able to get user information', async function () {
265 const res1 = await getMyUserInformation(server.url, accessTokenUser)
266 const userMe: MyUser = res1.body
268 const res2 = await getUserInformation(server.url, server.accessToken, userMe.id, true)
269 const userGet: User = res2.body
271 for (const user of [ userMe, userGet ]) {
272 expect(user.username).to.equal('user_1')
273 expect(user.email).to.equal('user_1@example.com')
274 expect(user.nsfwPolicy).to.equal('display')
275 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
276 expect(user.roleLabel).to.equal('User')
277 expect(user.id).to.be.a('number')
278 expect(user.account.displayName).to.equal('user_1')
279 expect(user.account.description).to.be.null
282 expect(userMe.adminFlags).to.be.undefined
283 expect(userGet.adminFlags).to.equal(UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST)
285 expect(userMe.specialPlaylists).to.have.lengthOf(1)
286 expect(userMe.specialPlaylists[0].type).to.equal(VideoPlaylistType.WATCH_LATER)
288 // Check stats are included with withStats
289 expect(userGet.videosCount).to.be.a('number')
290 expect(userGet.videosCount).to.equal(0)
291 expect(userGet.videoCommentsCount).to.be.a('number')
292 expect(userGet.videoCommentsCount).to.equal(0)
293 expect(userGet.videoAbusesCount).to.be.a('number')
294 expect(userGet.videoAbusesCount).to.equal(0)
295 expect(userGet.videoAbusesAcceptedCount).to.be.a('number')
296 expect(userGet.videoAbusesAcceptedCount).to.equal(0)
300 describe('My videos & quotas', function () {
302 it('Should be able to upload a video with this user', async function () {
305 const videoAttributes = {
306 name: 'super user video',
307 fixture: 'video_short.webm'
309 await uploadVideo(server.url, accessTokenUser, videoAttributes)
312 it('Should have video quota updated', async function () {
313 const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser)
314 const data = res.body
316 expect(data.videoQuotaUsed).to.equal(218910)
318 const resUsers = await getUsersList(server.url, server.accessToken)
320 const users: User[] = resUsers.body.data
321 const tmpUser = users.find(u => u.username === user.username)
322 expect(tmpUser.videoQuotaUsed).to.equal(218910)
325 it('Should be able to list my videos', async function () {
326 const res = await getMyVideos(server.url, accessTokenUser, 0, 5)
327 expect(res.body.total).to.equal(1)
329 const videos = res.body.data
330 expect(videos).to.have.lengthOf(1)
332 const video: Video = videos[0]
333 expect(video.name).to.equal('super user video')
334 expect(video.thumbnailPath).to.not.be.null
335 expect(video.previewPath).to.not.be.null
338 it('Should be able to search in my videos', async function () {
340 const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'user video')
341 expect(res.body.total).to.equal(1)
343 const videos = res.body.data
344 expect(videos).to.have.lengthOf(1)
348 const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'toto')
349 expect(res.body.total).to.equal(0)
351 const videos = res.body.data
352 expect(videos).to.have.lengthOf(0)
356 it('Should disable webtorrent, enable HLS, and update my quota', async function () {
360 const res = await getCustomConfig(server.url, server.accessToken)
361 const config = res.body as CustomConfig
362 config.transcoding.webtorrent.enabled = false
363 config.transcoding.hls.enabled = true
364 config.transcoding.enabled = true
365 await updateCustomSubConfig(server.url, server.accessToken, config)
369 const videoAttributes = {
370 name: 'super user video 2',
371 fixture: 'video_short.webm'
373 await uploadVideo(server.url, accessTokenUser, videoAttributes)
375 await waitJobs([ server ])
379 const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser)
380 const data = res.body
382 expect(data.videoQuotaUsed).to.be.greaterThan(220000)
387 describe('Users listing', function () {
389 it('Should list all the users', async function () {
390 const res = await getUsersList(server.url, server.accessToken)
391 const result = res.body
392 const total = result.total
393 const users = result.data
395 expect(total).to.equal(2)
396 expect(users).to.be.an('array')
397 expect(users.length).to.equal(2)
399 const user = users[0]
400 expect(user.username).to.equal('user_1')
401 expect(user.email).to.equal('user_1@example.com')
402 expect(user.nsfwPolicy).to.equal('display')
404 const rootUser = users[1]
405 expect(rootUser.username).to.equal('root')
406 expect(rootUser.email).to.equal('admin' + server.internalServerNumber + '@example.com')
407 expect(user.nsfwPolicy).to.equal('display')
412 it('Should list only the first user by username asc', async function () {
413 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, 'username')
415 const result = res.body
416 const total = result.total
417 const users = result.data
419 expect(total).to.equal(2)
420 expect(users.length).to.equal(1)
422 const user = users[0]
423 expect(user.username).to.equal('root')
424 expect(user.email).to.equal('admin' + server.internalServerNumber + '@example.com')
425 expect(user.roleLabel).to.equal('Administrator')
426 expect(user.nsfwPolicy).to.equal('display')
429 it('Should list only the first user by username desc', async function () {
430 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-username')
431 const result = res.body
432 const total = result.total
433 const users = result.data
435 expect(total).to.equal(2)
436 expect(users.length).to.equal(1)
438 const user = users[0]
439 expect(user.username).to.equal('user_1')
440 expect(user.email).to.equal('user_1@example.com')
441 expect(user.nsfwPolicy).to.equal('display')
444 it('Should list only the second user by createdAt desc', async function () {
445 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-createdAt')
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 all the users by createdAt asc', async function () {
460 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, '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(2)
468 expect(users[0].username).to.equal('root')
469 expect(users[0].email).to.equal('admin' + server.internalServerNumber + '@example.com')
470 expect(users[0].nsfwPolicy).to.equal('display')
472 expect(users[1].username).to.equal('user_1')
473 expect(users[1].email).to.equal('user_1@example.com')
474 expect(users[1].nsfwPolicy).to.equal('display')
477 it('Should search user by username', async function () {
478 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'oot')
479 const users = res.body.data as User[]
481 expect(res.body.total).to.equal(1)
482 expect(users.length).to.equal(1)
484 expect(users[0].username).to.equal('root')
487 it('Should search user by email', async function () {
489 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'r_1@exam')
490 const users = res.body.data as User[]
492 expect(res.body.total).to.equal(1)
493 expect(users.length).to.equal(1)
495 expect(users[0].username).to.equal('user_1')
496 expect(users[0].email).to.equal('user_1@example.com')
500 const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt', 'example')
501 const users = res.body.data as User[]
503 expect(res.body.total).to.equal(2)
504 expect(users.length).to.equal(2)
506 expect(users[0].username).to.equal('root')
507 expect(users[1].username).to.equal('user_1')
512 describe('Update my account', function () {
513 it('Should update my password', async function () {
516 accessToken: accessTokenUser,
517 currentPassword: 'super password',
518 password: 'new password'
520 user.password = 'new password'
522 await userLogin(server, user, 200)
525 it('Should be able to change the NSFW display attribute', async function () {
528 accessToken: accessTokenUser,
529 nsfwPolicy: 'do_not_list'
532 const res = await getMyUserInformation(server.url, accessTokenUser)
533 const user = res.body
535 expect(user.username).to.equal('user_1')
536 expect(user.email).to.equal('user_1@example.com')
537 expect(user.nsfwPolicy).to.equal('do_not_list')
538 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
539 expect(user.id).to.be.a('number')
540 expect(user.account.displayName).to.equal('user_1')
541 expect(user.account.description).to.be.null
544 it('Should be able to change the autoPlayVideo attribute', async function () {
547 accessToken: accessTokenUser,
551 const res = await getMyUserInformation(server.url, accessTokenUser)
552 const user = res.body
554 expect(user.autoPlayVideo).to.be.false
557 it('Should be able to change the autoPlayNextVideo attribute', async function () {
560 accessToken: accessTokenUser,
561 autoPlayNextVideo: true
564 const res = await getMyUserInformation(server.url, accessTokenUser)
565 const user = res.body
567 expect(user.autoPlayNextVideo).to.be.true
570 it('Should be able to change the email attribute', async function () {
573 accessToken: accessTokenUser,
574 currentPassword: 'new password',
575 email: 'updated@example.com'
578 const res = await getMyUserInformation(server.url, accessTokenUser)
579 const user = res.body
581 expect(user.username).to.equal('user_1')
582 expect(user.email).to.equal('updated@example.com')
583 expect(user.nsfwPolicy).to.equal('do_not_list')
584 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
585 expect(user.id).to.be.a('number')
586 expect(user.account.displayName).to.equal('user_1')
587 expect(user.account.description).to.be.null
590 it('Should be able to update my avatar', async function () {
591 const fixture = 'avatar.png'
593 await updateMyAvatar({
595 accessToken: accessTokenUser,
599 const res = await getMyUserInformation(server.url, accessTokenUser)
600 const user = res.body
602 await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png')
605 it('Should be able to update my display name', async function () {
608 accessToken: accessTokenUser,
609 displayName: 'new display name'
612 const res = await getMyUserInformation(server.url, accessTokenUser)
613 const user = res.body
615 expect(user.username).to.equal('user_1')
616 expect(user.email).to.equal('updated@example.com')
617 expect(user.nsfwPolicy).to.equal('do_not_list')
618 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
619 expect(user.id).to.be.a('number')
620 expect(user.account.displayName).to.equal('new display name')
621 expect(user.account.description).to.be.null
624 it('Should be able to update my description', async function () {
627 accessToken: accessTokenUser,
628 description: 'my super description updated'
631 const res = await getMyUserInformation(server.url, accessTokenUser)
632 const user: User = res.body
634 expect(user.username).to.equal('user_1')
635 expect(user.email).to.equal('updated@example.com')
636 expect(user.nsfwPolicy).to.equal('do_not_list')
637 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
638 expect(user.id).to.be.a('number')
639 expect(user.account.displayName).to.equal('new display name')
640 expect(user.account.description).to.equal('my super description updated')
641 expect(user.noWelcomeModal).to.be.false
642 expect(user.noInstanceConfigWarningModal).to.be.false
645 it('Should be able to update my theme', async function () {
646 for (const theme of [ 'background-red', 'default', 'instance-default' ]) {
649 accessToken: accessTokenUser,
653 const res = await getMyUserInformation(server.url, accessTokenUser)
654 const body: User = res.body
656 expect(body.theme).to.equal(theme)
660 it('Should be able to update my modal preferences', async function () {
663 accessToken: accessTokenUser,
664 noInstanceConfigWarningModal: true,
668 const res = await getMyUserInformation(server.url, accessTokenUser)
669 const user: User = res.body
671 expect(user.noWelcomeModal).to.be.true
672 expect(user.noInstanceConfigWarningModal).to.be.true
676 describe('Updating another user', function () {
677 it('Should be able to update another user', async function () {
682 email: 'updated2@example.com',
685 role: UserRole.MODERATOR,
686 adminFlags: UserAdminFlag.NONE
689 const res = await getUserInformation(server.url, accessToken, userId)
690 const user = res.body
692 expect(user.username).to.equal('user_1')
693 expect(user.email).to.equal('updated2@example.com')
694 expect(user.emailVerified).to.be.true
695 expect(user.nsfwPolicy).to.equal('do_not_list')
696 expect(user.videoQuota).to.equal(42)
697 expect(user.roleLabel).to.equal('Moderator')
698 expect(user.id).to.be.a('number')
699 expect(user.adminFlags).to.equal(UserAdminFlag.NONE)
702 it('Should have removed the user token', async function () {
703 await getMyUserVideoQuotaUsed(server.url, accessTokenUser, 401)
705 accessTokenUser = await userLogin(server, user)
708 it('Should be able to update another user password', async function () {
713 password: 'password updated'
716 await getMyUserVideoQuotaUsed(server.url, accessTokenUser, 401)
718 await userLogin(server, user, 400)
720 user.password = 'password updated'
721 accessTokenUser = await userLogin(server, user)
725 describe('Video blacklists', function () {
726 it('Should be able to list video blacklist by a moderator', async function () {
727 await getBlacklistedVideosList({ url: server.url, token: accessTokenUser })
731 describe('Remove a user', function () {
732 it('Should be able to remove this user', async function () {
733 await removeUser(server.url, userId, accessToken)
736 it('Should not be able to login with this user', async function () {
737 await userLogin(server, user, 400)
740 it('Should not have videos of this user', async function () {
741 const res = await getVideosList(server.url)
743 expect(res.body.total).to.equal(1)
745 const video = res.body.data[0]
746 expect(video.account.name).to.equal('root')
750 describe('Registering a new user', function () {
751 let user15AccessToken
753 it('Should register a new user', async function () {
754 const user = { displayName: 'super user 15', username: 'user_15', password: 'my super password' }
755 const channel = { name: 'my_user_15_channel', displayName: 'my channel rocks' }
757 await registerUserWithChannel({ url: server.url, user, channel })
760 it('Should be able to login with this registered user', async function () {
763 password: 'my super password'
766 user15AccessToken = await userLogin(server, user15)
769 it('Should have the correct display name', async function () {
770 const res = await getMyUserInformation(server.url, user15AccessToken)
771 const user: User = res.body
773 expect(user.account.displayName).to.equal('super user 15')
776 it('Should have the correct video quota', async function () {
777 const res = await getMyUserInformation(server.url, user15AccessToken)
778 const user = res.body
780 expect(user.videoQuota).to.equal(5 * 1024 * 1024)
783 it('Should have created the channel', async function () {
784 const res = await getVideoChannel(server.url, 'my_user_15_channel')
786 expect(res.body.displayName).to.equal('my channel rocks')
789 it('Should remove me', async function () {
791 const res = await getUsersList(server.url, server.accessToken)
792 expect(res.body.data.find(u => u.username === 'user_15')).to.not.be.undefined
795 await deleteMe(server.url, user15AccessToken)
798 const res = await getUsersList(server.url, server.accessToken)
799 expect(res.body.data.find(u => u.username === 'user_15')).to.be.undefined
804 describe('User blocking', function () {
806 let user16AccessToken
808 it('Should block and unblock a user', async function () {
811 password: 'my super password'
813 const resUser = await createUser({
815 accessToken: server.accessToken,
816 username: user16.username,
817 password: user16.password
819 user16Id = resUser.body.user.id
821 user16AccessToken = await userLogin(server, user16)
823 await getMyUserInformation(server.url, user16AccessToken, 200)
824 await blockUser(server.url, user16Id, server.accessToken)
826 await getMyUserInformation(server.url, user16AccessToken, 401)
827 await userLogin(server, user16, 400)
829 await unblockUser(server.url, user16Id, server.accessToken)
830 user16AccessToken = await userLogin(server, user16)
831 await getMyUserInformation(server.url, user16AccessToken, 200)
835 describe('User stats', function () {
837 let user17AccessToken
839 it('Should report correct initial statistics about a user', async function () {
842 password: 'my super password'
844 const resUser = await createUser({
846 accessToken: server.accessToken,
847 username: user17.username,
848 password: user17.password
851 user17Id = resUser.body.user.id
852 user17AccessToken = await userLogin(server, user17)
854 const res = await getUserInformation(server.url, server.accessToken, user17Id, true)
855 const user: User = res.body
857 expect(user.videosCount).to.equal(0)
858 expect(user.videoCommentsCount).to.equal(0)
859 expect(user.videoAbusesCount).to.equal(0)
860 expect(user.videoAbusesCreatedCount).to.equal(0)
861 expect(user.videoAbusesAcceptedCount).to.equal(0)
864 it('Should report correct videos count', async function () {
865 const videoAttributes = {
866 name: 'video to test user stats'
868 await uploadVideo(server.url, user17AccessToken, videoAttributes)
869 const res1 = await getVideosList(server.url)
870 videoId = res1.body.data.find(video => video.name === videoAttributes.name).id
872 const res2 = await getUserInformation(server.url, server.accessToken, user17Id, true)
873 const user: User = res2.body
875 expect(user.videosCount).to.equal(1)
878 it('Should report correct video comments for user', async function () {
879 const text = 'super comment'
880 await addVideoCommentThread(server.url, user17AccessToken, videoId, text)
882 const res = await getUserInformation(server.url, server.accessToken, user17Id, true)
883 const user: User = res.body
885 expect(user.videoCommentsCount).to.equal(1)
888 it('Should report correct video abuses counts', async function () {
889 const reason = 'my super bad reason'
890 await reportVideoAbuse(server.url, user17AccessToken, videoId, reason)
892 const res1 = await getVideoAbusesList(server.url, server.accessToken)
893 const abuseId = res1.body.data[0].id
895 const res2 = await getUserInformation(server.url, server.accessToken, user17Id, true)
896 const user2: User = res2.body
898 expect(user2.videoAbusesCount).to.equal(1) // number of incriminations
899 expect(user2.videoAbusesCreatedCount).to.equal(1) // number of reports created
901 const body: VideoAbuseUpdate = { state: VideoAbuseState.ACCEPTED }
902 await updateVideoAbuse(server.url, server.accessToken, videoId, abuseId, body)
904 const res3 = await getUserInformation(server.url, server.accessToken, user17Id, true)
905 const user3: User = res3.body
907 expect(user3.videoAbusesAcceptedCount).to.equal(1) // number of reports created accepted
911 after(async function () {
912 await cleanupTests([ server ])