]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/users/blocklist.ts
Add ability to forbid followers
[github/Chocobozzz/PeerTube.git] / server / tests / api / users / blocklist.ts
index 99fe04b8c0de1376f61c2d05e5158622777390b3..4bca27a94985d446e04aa5646e500907290733a2 100644 (file)
@@ -12,16 +12,16 @@ import {
   ServerInfo,
   uploadVideo,
   userLogin
-} from '../../utils/index'
-import { setAccessTokensToServers } from '../../utils/users/login'
-import { getVideosListWithToken } from '../../utils/videos/videos'
+} from '../../../../shared/utils/index'
+import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
+import { getVideosListWithToken, getVideosList } from '../../../../shared/utils/videos/videos'
 import {
   addVideoCommentReply,
   addVideoCommentThread,
   getVideoCommentThreads,
   getVideoThreadComments
-} from '../../utils/videos/video-comments'
-import { waitJobs } from '../../utils/server/jobs'
+} from '../../../../shared/utils/videos/video-comments'
+import { waitJobs } from '../../../../shared/utils/server/jobs'
 import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
 import {
   addAccountToAccountBlocklist,
@@ -36,14 +36,22 @@ import {
   removeAccountFromServerBlocklist,
   removeServerFromAccountBlocklist,
   removeServerFromServerBlocklist
-} from '../../utils/users/blocklist'
+} from '../../../../shared/utils/users/blocklist'
 
 const expect = chai.expect
 
 async function checkAllVideos (url: string, token: string) {
-  const res = await getVideosListWithToken(url, token)
+  {
+    const res = await getVideosListWithToken(url, token)
 
-  expect(res.body.data).to.have.lengthOf(4)
+    expect(res.body.data).to.have.lengthOf(4)
+  }
+
+  {
+    const res = await getVideosList(url)
+
+    expect(res.body.data).to.have.lengthOf(4)
+  }
 }
 
 async function checkAllComments (url: string, token: string, videoUUID: string) {
@@ -444,16 +452,19 @@ describe('Test blocklist', function () {
 
       it('Should hide its videos', async function () {
         for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {
-          const res = await getVideosListWithToken(servers[ 0 ].url, token)
+          const res1 = await getVideosList(servers[ 0 ].url)
+          const res2 = await getVideosListWithToken(servers[ 0 ].url, token)
 
-          const videos: Video[] = res.body.data
-          expect(videos).to.have.lengthOf(2)
+          for (const res of [ res1, res2 ]) {
+            const videos: Video[] = res.body.data
+            expect(videos).to.have.lengthOf(2)
 
-          const v1 = videos.find(v => v.name === 'video user 2')
-          const v2 = videos.find(v => v.name === 'video server 2')
+            const v1 = videos.find(v => v.name === 'video user 2')
+            const v2 = videos.find(v => v.name === 'video server 2')
 
-          expect(v1).to.be.undefined
-          expect(v2).to.be.undefined
+            expect(v1).to.be.undefined
+            expect(v2).to.be.undefined
+          }
         }
       })