aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/video-blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-28 13:59:22 +0100
committerChocobozzz <me@florianbigard.com>2017-12-28 13:59:22 +0100
commitc5d31dba56d669c0df0209761c43c5a6ac7cec4a (patch)
treefe72b56a1c0e7beb6e092c393a00ddfe93a5d71f /server/tests/api/video-blacklist.ts
parentdb799da3d2b2ea465165df78ff71effa653b6309 (diff)
downloadPeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.gz
PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.zst
PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.zip
Tests directories refractor
Diffstat (limited to 'server/tests/api/video-blacklist.ts')
-rw-r--r--server/tests/api/video-blacklist.ts98
1 files changed, 0 insertions, 98 deletions
diff --git a/server/tests/api/video-blacklist.ts b/server/tests/api/video-blacklist.ts
deleted file mode 100644
index 3afd8c510..000000000
--- a/server/tests/api/video-blacklist.ts
+++ /dev/null
@@ -1,98 +0,0 @@
1/* tslint:disable:no-unused-expression */
2
3import * as chai from 'chai'
4import 'mocha'
5import {
6 addVideoToBlacklist,
7 flushAndRunMultipleServers,
8 flushTests,
9 getVideosList,
10 killallServers,
11 searchVideo,
12 ServerInfo,
13 setAccessTokensToServers,
14 uploadVideo,
15 wait
16} from '../utils'
17import { doubleFollow } from '../utils/follows'
18
19const expect = chai.expect
20
21describe('Test video blacklists', function () {
22 let servers: ServerInfo[] = []
23
24 before(async function () {
25 this.timeout(50000)
26
27 // Run servers
28 servers = await flushAndRunMultipleServers(2)
29
30 // Get the access tokens
31 await setAccessTokensToServers(servers)
32
33 // Server 1 and server 2 follow each other
34 await doubleFollow(servers[0], servers[1])
35
36 // Upload a video on server 2
37 const videoAttributes = {
38 name: 'my super name for server 2',
39 description: 'my super description for server 2'
40 }
41 await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
42
43 // Wait videos propagation, server 2 has transcoding enabled
44 await wait(10000)
45
46 const res = await getVideosList(servers[0].url)
47 const videos = res.body.data
48
49 expect(videos.length).to.equal(1)
50
51 servers[0].remoteVideo = videos.find(video => video.name === 'my super name for server 2')
52 })
53
54 it('Should blacklist a remote video on server 1', async function () {
55 await addVideoToBlacklist(servers[0].url, servers[0].accessToken, servers[0].remoteVideo.id)
56 })
57
58 it('Should not have the video blacklisted in videos list on server 1', async function () {
59 const res = await getVideosList(servers[0].url)
60
61 expect(res.body.total).to.equal(0)
62 expect(res.body.data).to.be.an('array')
63 expect(res.body.data.length).to.equal(0)
64 })
65
66 it('Should not have the video blacklisted in videos search on server 1', async function () {
67 const res = await searchVideo(servers[0].url, 'name')
68
69 expect(res.body.total).to.equal(0)
70 expect(res.body.data).to.be.an('array')
71 expect(res.body.data.length).to.equal(0)
72 })
73
74 it('Should have the blacklisted video in videos list on server 2', async function () {
75 const res = await getVideosList(servers[1].url)
76
77 expect(res.body.total).to.equal(1)
78 expect(res.body.data).to.be.an('array')
79 expect(res.body.data.length).to.equal(1)
80 })
81
82 it('Should have the video blacklisted in videos search on server 2', async function () {
83 const res = await searchVideo(servers[1].url, 'name')
84
85 expect(res.body.total).to.equal(1)
86 expect(res.body.data).to.be.an('array')
87 expect(res.body.data.length).to.equal(1)
88 })
89
90 after(async function () {
91 killallServers(servers)
92
93 // Keep the logs if the test failed
94 if (this['ok']) {
95 await flushTests()
96 }
97 })
98})