diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-15 10:02:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch) | |
tree | da82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tests/api/server/bulk.ts | |
parent | 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff) | |
download | PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip |
Introduce videos command
Diffstat (limited to 'server/tests/api/server/bulk.ts')
-rw-r--r-- | server/tests/api/server/bulk.ts | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts index 20a9a3dc7..c83bcfb22 100644 --- a/server/tests/api/server/bulk.ts +++ b/server/tests/api/server/bulk.ts | |||
@@ -7,13 +7,10 @@ import { | |||
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
10 | getVideosList, | ||
11 | ServerInfo, | 10 | ServerInfo, |
12 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
13 | uploadVideo, | ||
14 | waitJobs | 12 | waitJobs |
15 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
16 | import { Video } from '@shared/models' | ||
17 | 14 | ||
18 | const expect = chai.expect | 15 | const expect = chai.expect |
19 | 16 | ||
@@ -64,11 +61,10 @@ describe('Test bulk actions', function () { | |||
64 | describe('Bulk remove comments', function () { | 61 | describe('Bulk remove comments', function () { |
65 | async function checkInstanceCommentsRemoved () { | 62 | async function checkInstanceCommentsRemoved () { |
66 | { | 63 | { |
67 | const res = await getVideosList(servers[0].url) | 64 | const { data } = await servers[0].videosCommand.list() |
68 | const videos = res.body.data as Video[] | ||
69 | 65 | ||
70 | // Server 1 should not have these comments anymore | 66 | // Server 1 should not have these comments anymore |
71 | for (const video of videos) { | 67 | for (const video of data) { |
72 | const { data } = await servers[0].commentsCommand.listThreads({ videoId: video.id }) | 68 | const { data } = await servers[0].commentsCommand.listThreads({ videoId: video.id }) |
73 | const comment = data.find(c => c.text === 'comment by user 3') | 69 | const comment = data.find(c => c.text === 'comment by user 3') |
74 | 70 | ||
@@ -77,11 +73,10 @@ describe('Test bulk actions', function () { | |||
77 | } | 73 | } |
78 | 74 | ||
79 | { | 75 | { |
80 | const res = await getVideosList(servers[1].url) | 76 | const { data } = await servers[1].videosCommand.list() |
81 | const videos = res.body.data as Video[] | ||
82 | 77 | ||
83 | // Server 1 should not have these comments on videos of server 1 | 78 | // Server 1 should not have these comments on videos of server 1 |
84 | for (const video of videos) { | 79 | for (const video of data) { |
85 | const { data } = await servers[1].commentsCommand.listThreads({ videoId: video.id }) | 80 | const { data } = await servers[1].commentsCommand.listThreads({ videoId: video.id }) |
86 | const comment = data.find(c => c.text === 'comment by user 3') | 81 | const comment = data.find(c => c.text === 'comment by user 3') |
87 | 82 | ||
@@ -97,17 +92,17 @@ describe('Test bulk actions', function () { | |||
97 | before(async function () { | 92 | before(async function () { |
98 | this.timeout(120000) | 93 | this.timeout(120000) |
99 | 94 | ||
100 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 1 server 1' }) | 95 | await servers[0].videosCommand.upload({ attributes: { name: 'video 1 server 1' } }) |
101 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 2 server 1' }) | 96 | await servers[0].videosCommand.upload({ attributes: { name: 'video 2 server 1' } }) |
102 | await uploadVideo(servers[0].url, user1Token, { name: 'video 3 server 1' }) | 97 | await servers[0].videosCommand.upload({ token: user1Token, attributes: { name: 'video 3 server 1' } }) |
103 | 98 | ||
104 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 server 2' }) | 99 | await servers[1].videosCommand.upload({ attributes: { name: 'video 1 server 2' } }) |
105 | 100 | ||
106 | await waitJobs(servers) | 101 | await waitJobs(servers) |
107 | 102 | ||
108 | { | 103 | { |
109 | const res = await getVideosList(servers[0].url) | 104 | const { data } = await servers[0].videosCommand.list() |
110 | for (const video of res.body.data) { | 105 | for (const video of data) { |
111 | await servers[0].commentsCommand.createThread({ videoId: video.id, text: 'comment by root server 1' }) | 106 | await servers[0].commentsCommand.createThread({ videoId: video.id, text: 'comment by root server 1' }) |
112 | await servers[0].commentsCommand.createThread({ token: user1Token, videoId: video.id, text: 'comment by user 1' }) | 107 | await servers[0].commentsCommand.createThread({ token: user1Token, videoId: video.id, text: 'comment by user 1' }) |
113 | await servers[0].commentsCommand.createThread({ token: user2Token, videoId: video.id, text: 'comment by user 2' }) | 108 | await servers[0].commentsCommand.createThread({ token: user2Token, videoId: video.id, text: 'comment by user 2' }) |
@@ -115,9 +110,9 @@ describe('Test bulk actions', function () { | |||
115 | } | 110 | } |
116 | 111 | ||
117 | { | 112 | { |
118 | const res = await getVideosList(servers[1].url) | 113 | const { data } = await servers[1].videosCommand.list() |
119 | 114 | ||
120 | for (const video of res.body.data) { | 115 | for (const video of data) { |
121 | await servers[1].commentsCommand.createThread({ videoId: video.id, text: 'comment by root server 2' }) | 116 | await servers[1].commentsCommand.createThread({ videoId: video.id, text: 'comment by root server 2' }) |
122 | 117 | ||
123 | const comment = await servers[1].commentsCommand.createThread({ token: user3Token, videoId: video.id, text: 'comment by user 3' }) | 118 | const comment = await servers[1].commentsCommand.createThread({ token: user3Token, videoId: video.id, text: 'comment by user 3' }) |
@@ -142,9 +137,9 @@ describe('Test bulk actions', function () { | |||
142 | await waitJobs(servers) | 137 | await waitJobs(servers) |
143 | 138 | ||
144 | for (const server of servers) { | 139 | for (const server of servers) { |
145 | const res = await getVideosList(server.url) | 140 | const { data } = await server.videosCommand.list() |
146 | 141 | ||
147 | for (const video of res.body.data) { | 142 | for (const video of data) { |
148 | const { data } = await server.commentsCommand.listThreads({ videoId: video.id }) | 143 | const { data } = await server.commentsCommand.listThreads({ videoId: video.id }) |
149 | const comment = data.find(c => c.text === 'comment by user 2') | 144 | const comment = data.find(c => c.text === 'comment by user 2') |
150 | 145 | ||