diff options
Diffstat (limited to 'server/tests/api/video-blacklist-management.ts')
-rw-r--r-- | server/tests/api/video-blacklist-management.ts | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/server/tests/api/video-blacklist-management.ts b/server/tests/api/video-blacklist-management.ts index 7057f4b23..718789318 100644 --- a/server/tests/api/video-blacklist-management.ts +++ b/server/tests/api/video-blacklist-management.ts | |||
@@ -1,31 +1,31 @@ | |||
1 | /* tslint:disable:no-unused-expressions */ | 1 | /* tslint:disable:no-unused-expressions */ |
2 | 2 | ||
3 | import 'mocha' | ||
4 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
5 | const expect = chai.expect | ||
6 | import * as lodash from 'lodash' | 4 | import * as lodash from 'lodash' |
7 | const orderBy = lodash.orderBy | 5 | import 'mocha' |
8 | |||
9 | import { | 6 | import { |
10 | ServerInfo, | 7 | addVideoToBlacklist, |
11 | flushTests, | ||
12 | wait, | ||
13 | setAccessTokensToServers, | ||
14 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
15 | killallServers, | 9 | flushTests, |
16 | makeFriends, | 10 | getBlacklistedVideosList, |
11 | getSortedBlacklistedVideosList, | ||
17 | getVideosList, | 12 | getVideosList, |
18 | uploadVideo, | 13 | killallServers, |
19 | addVideoToBlacklist, | ||
20 | removeVideoFromBlacklist, | 14 | removeVideoFromBlacklist, |
21 | getBlacklistedVideosList, | 15 | ServerInfo, |
22 | getSortedBlacklistedVideosList | 16 | setAccessTokensToServers, |
17 | uploadVideo, | ||
18 | wait | ||
23 | } from '../utils' | 19 | } from '../utils' |
20 | import { doubleFollow } from '../utils/follows' | ||
21 | |||
22 | const expect = chai.expect | ||
23 | const orderBy = lodash.orderBy | ||
24 | 24 | ||
25 | describe('Test video blacklist management', function () { | 25 | describe('Test video blacklist management', function () { |
26 | let servers: ServerInfo[] = [] | 26 | let servers: ServerInfo[] = [] |
27 | 27 | ||
28 | async function blacklistVideosOnPod (server: ServerInfo) { | 28 | async function blacklistVideosOnServer (server: ServerInfo) { |
29 | const res = await getVideosList(server.url) | 29 | const res = await getVideosList(server.url) |
30 | 30 | ||
31 | const videos = res.body.data | 31 | const videos = res.body.data |
@@ -43,18 +43,18 @@ describe('Test video blacklist management', function () { | |||
43 | // Get the access tokens | 43 | // Get the access tokens |
44 | await setAccessTokensToServers(servers) | 44 | await setAccessTokensToServers(servers) |
45 | 45 | ||
46 | // Pod 1 makes friend with pod 2 | 46 | // Server 1 and server 2 follow each other |
47 | await makeFriends(servers[0].url, servers[0].accessToken) | 47 | await doubleFollow(servers[0], servers[1]) |
48 | 48 | ||
49 | // Upload 2 videos on pod 2 | 49 | // Upload 2 videos on server 2 |
50 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 1st video', description: 'A video on pod 2' }) | 50 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 1st video', description: 'A video on server 2' }) |
51 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 2nd video', description: 'A video on pod 2' }) | 51 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 2nd video', description: 'A video on server 2' }) |
52 | 52 | ||
53 | // Wait videos propagation | 53 | // Wait videos propagation |
54 | await wait(22000) | 54 | await wait(50000) |
55 | 55 | ||
56 | // Blacklist the two videos on pod 1 | 56 | // Blacklist the two videos on server 1 |
57 | await blacklistVideosOnPod(servers[0]) | 57 | await blacklistVideosOnServer(servers[0]) |
58 | }) | 58 | }) |
59 | 59 | ||
60 | describe('When listing blacklisted videos', function () { | 60 | describe('When listing blacklisted videos', function () { |
@@ -112,14 +112,14 @@ describe('Test video blacklist management', function () { | |||
112 | let videoToRemove | 112 | let videoToRemove |
113 | let blacklist = [] | 113 | let blacklist = [] |
114 | 114 | ||
115 | it('Should not have any video in videos list on pod 1', async function () { | 115 | it('Should not have any video in videos list on server 1', async function () { |
116 | const res = await getVideosList(servers[0].url) | 116 | const res = await getVideosList(servers[0].url) |
117 | expect(res.body.total).to.equal(0) | 117 | expect(res.body.total).to.equal(0) |
118 | expect(res.body.data).to.be.an('array') | 118 | expect(res.body.data).to.be.an('array') |
119 | expect(res.body.data.length).to.equal(0) | 119 | expect(res.body.data.length).to.equal(0) |
120 | }) | 120 | }) |
121 | 121 | ||
122 | it('Should remove a video from the blacklist on pod 1', async function () { | 122 | it('Should remove a video from the blacklist on server 1', async function () { |
123 | // Get one video in the blacklist | 123 | // Get one video in the blacklist |
124 | const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-name') | 124 | const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-name') |
125 | videoToRemove = res.body.data[0] | 125 | videoToRemove = res.body.data[0] |
@@ -129,7 +129,7 @@ describe('Test video blacklist management', function () { | |||
129 | await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoToRemove.videoId) | 129 | await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoToRemove.videoId) |
130 | }) | 130 | }) |
131 | 131 | ||
132 | it('Should have the ex-blacklisted video in videos list on pod 1', async function () { | 132 | it('Should have the ex-blacklisted video in videos list on server 1', async function () { |
133 | const res = await getVideosList(servers[0].url) | 133 | const res = await getVideosList(servers[0].url) |
134 | expect(res.body.total).to.equal(1) | 134 | expect(res.body.total).to.equal(1) |
135 | 135 | ||
@@ -141,7 +141,7 @@ describe('Test video blacklist management', function () { | |||
141 | expect(videos[0].id).to.equal(videoToRemove.videoId) | 141 | expect(videos[0].id).to.equal(videoToRemove.videoId) |
142 | }) | 142 | }) |
143 | 143 | ||
144 | it('Should not have the ex-blacklisted video in videos blacklist list on pod 1', async function () { | 144 | it('Should not have the ex-blacklisted video in videos blacklist list on server 1', async function () { |
145 | const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-name') | 145 | const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-name') |
146 | expect(res.body.total).to.equal(1) | 146 | expect(res.body.total).to.equal(1) |
147 | 147 | ||