diff options
Diffstat (limited to 'server/tests/external-plugins/auto-block-videos.ts')
-rw-r--r-- | server/tests/external-plugins/auto-block-videos.ts | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts index f4b55522a..1cce15a2f 100644 --- a/server/tests/external-plugins/auto-block-videos.ts +++ b/server/tests/external-plugins/auto-block-videos.ts | |||
@@ -2,27 +2,23 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { Video } from '@shared/models' | ||
6 | import { | ||
7 | doubleFollow, | ||
8 | getVideosList, | ||
9 | MockBlocklist, | ||
10 | setAccessTokensToServers, | ||
11 | uploadVideoAndGetId, | ||
12 | wait | ||
13 | } from '../../../shared/extra-utils' | ||
14 | import { | 5 | import { |
15 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
16 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
17 | killallServers, | 9 | killallServers, |
10 | MockBlocklist, | ||
18 | reRunServer, | 11 | reRunServer, |
19 | ServerInfo | 12 | ServerInfo, |
20 | } from '../../../shared/extra-utils/server/servers' | 13 | setAccessTokensToServers, |
14 | wait | ||
15 | } from '@shared/extra-utils' | ||
16 | import { Video } from '@shared/models' | ||
21 | 17 | ||
22 | async function check (server: ServerInfo, videoUUID: string, exists = true) { | 18 | async function check (server: ServerInfo, videoUUID: string, exists = true) { |
23 | const res = await getVideosList(server.url) | 19 | const { data } = await server.videosCommand.list() |
24 | 20 | ||
25 | const video = res.body.data.find(v => v.uuid === videoUUID) | 21 | const video = data.find(v => v.uuid === videoUUID) |
26 | 22 | ||
27 | if (exists) expect(video).to.not.be.undefined | 23 | if (exists) expect(video).to.not.be.undefined |
28 | else expect(video).to.be.undefined | 24 | else expect(video).to.be.undefined |
@@ -48,19 +44,19 @@ describe('Official plugin auto-block videos', function () { | |||
48 | blocklistServer = new MockBlocklist() | 44 | blocklistServer = new MockBlocklist() |
49 | port = await blocklistServer.initialize() | 45 | port = await blocklistServer.initialize() |
50 | 46 | ||
51 | await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' }) | 47 | await await servers[0].videosCommand.quickUpload({ name: 'video server 1' }) |
52 | await uploadVideoAndGetId({ server: servers[1], videoName: 'video server 2' }) | 48 | await await servers[1].videosCommand.quickUpload({ name: 'video server 2' }) |
53 | await uploadVideoAndGetId({ server: servers[1], videoName: 'video 2 server 2' }) | 49 | await await servers[1].videosCommand.quickUpload({ name: 'video 2 server 2' }) |
54 | await uploadVideoAndGetId({ server: servers[1], videoName: 'video 3 server 2' }) | 50 | await await servers[1].videosCommand.quickUpload({ name: 'video 3 server 2' }) |
55 | 51 | ||
56 | { | 52 | { |
57 | const res = await getVideosList(servers[0].url) | 53 | const { data } = await servers[0].videosCommand.list() |
58 | server1Videos = res.body.data.map(v => Object.assign(v, { url: servers[0].url + '/videos/watch/' + v.uuid })) | 54 | server1Videos = data.map(v => Object.assign(v, { url: servers[0].url + '/videos/watch/' + v.uuid })) |
59 | } | 55 | } |
60 | 56 | ||
61 | { | 57 | { |
62 | const res = await getVideosList(servers[1].url) | 58 | const { data } = await servers[1].videosCommand.list() |
63 | server2Videos = res.body.data.map(v => Object.assign(v, { url: servers[1].url + '/videos/watch/' + v.uuid })) | 59 | server2Videos = data.map(v => Object.assign(v, { url: servers[1].url + '/videos/watch/' + v.uuid })) |
64 | } | 60 | } |
65 | 61 | ||
66 | await doubleFollow(servers[0], servers[1]) | 62 | await doubleFollow(servers[0], servers[1]) |