aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli')
-rw-r--r--server/tests/cli/create-import-video-file-job.ts22
-rw-r--r--server/tests/cli/create-transcoding-job.ts38
-rw-r--r--server/tests/cli/optimize-old-videos.ts18
-rw-r--r--server/tests/cli/peertube.ts28
-rw-r--r--server/tests/cli/plugins.ts10
-rw-r--r--server/tests/cli/prune-storage.ts30
-rw-r--r--server/tests/cli/regenerate-thumbnails.ts20
-rw-r--r--server/tests/cli/reset-password.ts6
-rw-r--r--server/tests/cli/update-host.ts24
9 files changed, 98 insertions, 98 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index b1d9da242..26f4bdc8d 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -35,12 +35,12 @@ describe('Test create import video jobs', function () {
35 35
36 // Upload two videos for our needs 36 // Upload two videos for our needs
37 { 37 {
38 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video1' } }) 38 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video1' } })
39 video1UUID = uuid 39 video1UUID = uuid
40 } 40 }
41 41
42 { 42 {
43 const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video2' } }) 43 const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video2' } })
44 video2UUID = uuid 44 video2UUID = uuid
45 } 45 }
46 46
@@ -50,16 +50,16 @@ describe('Test create import video jobs', function () {
50 50
51 it('Should run a import job on video 1 with a lower resolution', async function () { 51 it('Should run a import job on video 1 with a lower resolution', async function () {
52 const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm` 52 const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`
53 await servers[0].cliCommand.execWithEnv(command) 53 await servers[0].cli.execWithEnv(command)
54 54
55 await waitJobs(servers) 55 await waitJobs(servers)
56 56
57 for (const server of servers) { 57 for (const server of servers) {
58 const { data: videos } = await server.videosCommand.list() 58 const { data: videos } = await server.videos.list()
59 expect(videos).to.have.lengthOf(2) 59 expect(videos).to.have.lengthOf(2)
60 60
61 const video = videos.find(({ uuid }) => uuid === video1UUID) 61 const video = videos.find(({ uuid }) => uuid === video1UUID)
62 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 62 const videoDetails = await server.videos.get({ id: video.uuid })
63 63
64 expect(videoDetails.files).to.have.lengthOf(2) 64 expect(videoDetails.files).to.have.lengthOf(2)
65 const [ originalVideo, transcodedVideo ] = videoDetails.files 65 const [ originalVideo, transcodedVideo ] = videoDetails.files
@@ -70,16 +70,16 @@ describe('Test create import video jobs', function () {
70 70
71 it('Should run a import job on video 2 with the same resolution and a different extension', async function () { 71 it('Should run a import job on video 2 with the same resolution and a different extension', async function () {
72 const command = `npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv` 72 const command = `npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`
73 await servers[1].cliCommand.execWithEnv(command) 73 await servers[1].cli.execWithEnv(command)
74 74
75 await waitJobs(servers) 75 await waitJobs(servers)
76 76
77 for (const server of servers) { 77 for (const server of servers) {
78 const { data: videos } = await server.videosCommand.list() 78 const { data: videos } = await server.videos.list()
79 expect(videos).to.have.lengthOf(2) 79 expect(videos).to.have.lengthOf(2)
80 80
81 const video = videos.find(({ uuid }) => uuid === video2UUID) 81 const video = videos.find(({ uuid }) => uuid === video2UUID)
82 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 82 const videoDetails = await server.videos.get({ id: video.uuid })
83 83
84 expect(videoDetails.files).to.have.lengthOf(4) 84 expect(videoDetails.files).to.have.lengthOf(4)
85 const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetails.files 85 const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetails.files
@@ -92,16 +92,16 @@ describe('Test create import video jobs', function () {
92 92
93 it('Should run a import job on video 2 with the same resolution and the same extension', async function () { 93 it('Should run a import job on video 2 with the same resolution and the same extension', async function () {
94 const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm` 94 const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`
95 await servers[0].cliCommand.execWithEnv(command) 95 await servers[0].cli.execWithEnv(command)
96 96
97 await waitJobs(servers) 97 await waitJobs(servers)
98 98
99 for (const server of servers) { 99 for (const server of servers) {
100 const { data: videos } = await server.videosCommand.list() 100 const { data: videos } = await server.videos.list()
101 expect(videos).to.have.lengthOf(2) 101 expect(videos).to.have.lengthOf(2)
102 102
103 const video = videos.find(({ uuid }) => uuid === video1UUID) 103 const video = videos.find(({ uuid }) => uuid === video1UUID)
104 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 104 const videoDetails = await server.videos.get({ id: video.uuid })
105 105
106 expect(videoDetails.files).to.have.lengthOf(2) 106 expect(videoDetails.files).to.have.lengthOf(2)
107 const [ video720, video480 ] = videoDetails.files 107 const [ video720, video480 ] = videoDetails.files
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index f629306e6..c9bbab802 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -42,12 +42,12 @@ describe('Test create transcoding jobs', function () {
42 servers = await flushAndRunMultipleServers(2) 42 servers = await flushAndRunMultipleServers(2)
43 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
44 44
45 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) 45 await servers[0].config.updateCustomSubConfig({ newConfig: config })
46 46
47 await doubleFollow(servers[0], servers[1]) 47 await doubleFollow(servers[0], servers[1])
48 48
49 for (let i = 1; i <= 5; i++) { 49 for (let i = 1; i <= 5; i++) {
50 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video' + i } }) 50 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' + i } })
51 videosUUID.push(uuid) 51 videosUUID.push(uuid)
52 } 52 }
53 53
@@ -58,11 +58,11 @@ describe('Test create transcoding jobs', function () {
58 this.timeout(30000) 58 this.timeout(30000)
59 59
60 for (const server of servers) { 60 for (const server of servers) {
61 const { data } = await server.videosCommand.list() 61 const { data } = await server.videos.list()
62 expect(data).to.have.lengthOf(videosUUID.length) 62 expect(data).to.have.lengthOf(videosUUID.length)
63 63
64 for (const video of data) { 64 for (const video of data) {
65 const videoDetail = await server.videosCommand.get({ id: video.uuid }) 65 const videoDetail = await server.videos.get({ id: video.uuid })
66 expect(videoDetail.files).to.have.lengthOf(1) 66 expect(videoDetail.files).to.have.lengthOf(1)
67 expect(videoDetail.streamingPlaylists).to.have.lengthOf(0) 67 expect(videoDetail.streamingPlaylists).to.have.lengthOf(0)
68 } 68 }
@@ -72,16 +72,16 @@ describe('Test create transcoding jobs', function () {
72 it('Should run a transcoding job on video 2', async function () { 72 it('Should run a transcoding job on video 2', async function () {
73 this.timeout(60000) 73 this.timeout(60000)
74 74
75 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[1]}`) 75 await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[1]}`)
76 await waitJobs(servers) 76 await waitJobs(servers)
77 77
78 for (const server of servers) { 78 for (const server of servers) {
79 const { data } = await server.videosCommand.list() 79 const { data } = await server.videos.list()
80 80
81 let infoHashes: { [id: number]: string } 81 let infoHashes: { [id: number]: string }
82 82
83 for (const video of data) { 83 for (const video of data) {
84 const videoDetail = await server.videosCommand.get({ id: video.uuid }) 84 const videoDetail = await server.videos.get({ id: video.uuid })
85 85
86 if (video.uuid === videosUUID[1]) { 86 if (video.uuid === videosUUID[1]) {
87 expect(videoDetail.files).to.have.lengthOf(4) 87 expect(videoDetail.files).to.have.lengthOf(4)
@@ -110,15 +110,15 @@ describe('Test create transcoding jobs', function () {
110 it('Should run a transcoding job on video 1 with resolution', async function () { 110 it('Should run a transcoding job on video 1 with resolution', async function () {
111 this.timeout(60000) 111 this.timeout(60000)
112 112
113 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[0]} -r 480`) 113 await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[0]} -r 480`)
114 114
115 await waitJobs(servers) 115 await waitJobs(servers)
116 116
117 for (const server of servers) { 117 for (const server of servers) {
118 const { data } = await server.videosCommand.list() 118 const { data } = await server.videos.list()
119 expect(data).to.have.lengthOf(videosUUID.length) 119 expect(data).to.have.lengthOf(videosUUID.length)
120 120
121 const videoDetails = await server.videosCommand.get({ id: videosUUID[0] }) 121 const videoDetails = await server.videos.get({ id: videosUUID[0] })
122 122
123 expect(videoDetails.files).to.have.lengthOf(2) 123 expect(videoDetails.files).to.have.lengthOf(2)
124 expect(videoDetails.files[0].resolution.id).to.equal(720) 124 expect(videoDetails.files[0].resolution.id).to.equal(720)
@@ -131,12 +131,12 @@ describe('Test create transcoding jobs', function () {
131 it('Should generate an HLS resolution', async function () { 131 it('Should generate an HLS resolution', async function () {
132 this.timeout(120000) 132 this.timeout(120000)
133 133
134 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`) 134 await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`)
135 135
136 await waitJobs(servers) 136 await waitJobs(servers)
137 137
138 for (const server of servers) { 138 for (const server of servers) {
139 const videoDetails = await server.videosCommand.get({ id: videosUUID[2] }) 139 const videoDetails = await server.videos.get({ id: videosUUID[2] })
140 140
141 expect(videoDetails.files).to.have.lengthOf(1) 141 expect(videoDetails.files).to.have.lengthOf(1)
142 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) 142 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
@@ -150,12 +150,12 @@ describe('Test create transcoding jobs', function () {
150 it('Should not duplicate an HLS resolution', async function () { 150 it('Should not duplicate an HLS resolution', async function () {
151 this.timeout(120000) 151 this.timeout(120000)
152 152
153 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`) 153 await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`)
154 154
155 await waitJobs(servers) 155 await waitJobs(servers)
156 156
157 for (const server of servers) { 157 for (const server of servers) {
158 const videoDetails = await server.videosCommand.get({ id: videosUUID[2] }) 158 const videoDetails = await server.videos.get({ id: videosUUID[2] })
159 159
160 const files = videoDetails.streamingPlaylists[0].files 160 const files = videoDetails.streamingPlaylists[0].files
161 expect(files).to.have.lengthOf(1) 161 expect(files).to.have.lengthOf(1)
@@ -166,12 +166,12 @@ describe('Test create transcoding jobs', function () {
166 it('Should generate all HLS resolutions', async function () { 166 it('Should generate all HLS resolutions', async function () {
167 this.timeout(120000) 167 this.timeout(120000)
168 168
169 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[3]} --generate-hls`) 169 await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[3]} --generate-hls`)
170 170
171 await waitJobs(servers) 171 await waitJobs(servers)
172 172
173 for (const server of servers) { 173 for (const server of servers) {
174 const videoDetails = await server.videosCommand.get({ id: videosUUID[3] }) 174 const videoDetails = await server.videos.get({ id: videosUUID[3] })
175 175
176 expect(videoDetails.files).to.have.lengthOf(1) 176 expect(videoDetails.files).to.have.lengthOf(1)
177 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) 177 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
@@ -185,14 +185,14 @@ describe('Test create transcoding jobs', function () {
185 this.timeout(120000) 185 this.timeout(120000)
186 186
187 config.transcoding.hls.enabled = true 187 config.transcoding.hls.enabled = true
188 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) 188 await servers[0].config.updateCustomSubConfig({ newConfig: config })
189 189
190 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[4]}`) 190 await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[4]}`)
191 191
192 await waitJobs(servers) 192 await waitJobs(servers)
193 193
194 for (const server of servers) { 194 for (const server of servers) {
195 const videoDetails = await server.videosCommand.get({ id: videosUUID[4] }) 195 const videoDetails = await server.videos.get({ id: videosUUID[4] })
196 196
197 expect(videoDetails.files).to.have.lengthOf(4) 197 expect(videoDetails.files).to.have.lengthOf(4)
198 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) 198 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index ef8603a33..eefc95a6d 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -41,8 +41,8 @@ describe('Test optimize old videos', function () {
41 } 41 }
42 42
43 // Upload two videos for our needs 43 // Upload two videos for our needs
44 await servers[0].videosCommand.upload({ attributes: { name: 'video1', fixture: tempFixturePath } }) 44 await servers[0].videos.upload({ attributes: { name: 'video1', fixture: tempFixturePath } })
45 await servers[0].videosCommand.upload({ attributes: { name: 'video2', fixture: tempFixturePath } }) 45 await servers[0].videos.upload({ attributes: { name: 'video2', fixture: tempFixturePath } })
46 46
47 await waitJobs(servers) 47 await waitJobs(servers)
48 }) 48 })
@@ -51,11 +51,11 @@ describe('Test optimize old videos', function () {
51 this.timeout(30000) 51 this.timeout(30000)
52 52
53 for (const server of servers) { 53 for (const server of servers) {
54 const { data } = await server.videosCommand.list() 54 const { data } = await server.videos.list()
55 expect(data).to.have.lengthOf(2) 55 expect(data).to.have.lengthOf(2)
56 56
57 for (const video of data) { 57 for (const video of data) {
58 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 58 const videoDetails = await server.videos.get({ id: video.uuid })
59 expect(videoDetails.files).to.have.lengthOf(1) 59 expect(videoDetails.files).to.have.lengthOf(1)
60 } 60 }
61 } 61 }
@@ -64,29 +64,29 @@ describe('Test optimize old videos', function () {
64 it('Should run optimize script', async function () { 64 it('Should run optimize script', async function () {
65 this.timeout(200000) 65 this.timeout(200000)
66 66
67 await servers[0].cliCommand.execWithEnv('npm run optimize-old-videos') 67 await servers[0].cli.execWithEnv('npm run optimize-old-videos')
68 await waitJobs(servers) 68 await waitJobs(servers)
69 69
70 for (const server of servers) { 70 for (const server of servers) {
71 const { data } = await server.videosCommand.list() 71 const { data } = await server.videos.list()
72 expect(data).to.have.lengthOf(2) 72 expect(data).to.have.lengthOf(2)
73 73
74 for (const video of data) { 74 for (const video of data) {
75 await server.videosCommand.view({ id: video.uuid }) 75 await server.videos.view({ id: video.uuid })
76 76
77 // Refresh video 77 // Refresh video
78 await waitJobs(servers) 78 await waitJobs(servers)
79 await wait(5000) 79 await wait(5000)
80 await waitJobs(servers) 80 await waitJobs(servers)
81 81
82 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 82 const videoDetails = await server.videos.get({ id: video.uuid })
83 83
84 expect(videoDetails.files).to.have.lengthOf(1) 84 expect(videoDetails.files).to.have.lengthOf(1)
85 const file = videoDetails.files[0] 85 const file = videoDetails.files[0]
86 86
87 expect(file.size).to.be.below(8000000) 87 expect(file.size).to.be.below(8000000)
88 88
89 const path = servers[0].serversCommand.buildDirectory(join('videos', video.uuid + '-' + file.resolution.id + '.mp4')) 89 const path = servers[0].servers.buildDirectory(join('videos', video.uuid + '-' + file.resolution.id + '.mp4'))
90 const bitrate = await getVideoFileBitrate(path) 90 const bitrate = await getVideoFileBitrate(path)
91 const fps = await getVideoFileFPS(path) 91 const fps = await getVideoFileFPS(path)
92 const resolution = await getVideoFileResolution(path) 92 const resolution = await getVideoFileResolution(path)
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index fe5f63191..a83aa7724 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -30,16 +30,16 @@ describe('Test CLI wrapper', function () {
30 server = await flushAndRunServer(1) 30 server = await flushAndRunServer(1)
31 await setAccessTokensToServers([ server ]) 31 await setAccessTokensToServers([ server ])
32 32
33 await server.usersCommand.create({ username: 'user_1', password: 'super_password' }) 33 await server.users.create({ username: 'user_1', password: 'super_password' })
34 34
35 userAccessToken = await server.loginCommand.getAccessToken({ username: 'user_1', password: 'super_password' }) 35 userAccessToken = await server.login.getAccessToken({ username: 'user_1', password: 'super_password' })
36 36
37 { 37 {
38 const attributes = { name: 'user_channel', displayName: 'User channel', support: 'super support text' } 38 const attributes = { name: 'user_channel', displayName: 'User channel', support: 'super support text' }
39 await server.channelsCommand.create({ token: userAccessToken, attributes }) 39 await server.channels.create({ token: userAccessToken, attributes })
40 } 40 }
41 41
42 cliCommand = server.cliCommand 42 cliCommand = server.cli
43 }) 43 })
44 44
45 describe('Authentication and instance selection', function () { 45 describe('Authentication and instance selection', function () {
@@ -48,7 +48,7 @@ describe('Test CLI wrapper', function () {
48 const stdout = await cliCommand.execWithEnv(`${cmd} token --url ${server.url} --username user_1 --password super_password`) 48 const stdout = await cliCommand.execWithEnv(`${cmd} token --url ${server.url} --username user_1 --password super_password`)
49 const token = stdout.trim() 49 const token = stdout.trim()
50 50
51 const body = await server.usersCommand.getMyInfo({ token }) 51 const body = await server.users.getMyInfo({ token })
52 expect(body.username).to.equal('user_1') 52 expect(body.username).to.equal('user_1')
53 }) 53 })
54 54
@@ -103,10 +103,10 @@ describe('Test CLI wrapper', function () {
103 }) 103 })
104 104
105 it('Should have the video uploaded', async function () { 105 it('Should have the video uploaded', async function () {
106 const { total, data } = await server.videosCommand.list() 106 const { total, data } = await server.videos.list()
107 expect(total).to.equal(1) 107 expect(total).to.equal(1)
108 108
109 const video = await server.videosCommand.get({ id: data[0].uuid }) 109 const video = await server.videos.get({ id: data[0].uuid })
110 expect(video.name).to.equal('test upload') 110 expect(video.name).to.equal('test upload')
111 expect(video.support).to.equal('support_text') 111 expect(video.support).to.equal('support_text')
112 expect(video.channel.name).to.equal('user_channel') 112 expect(video.channel.name).to.equal('user_channel')
@@ -128,19 +128,19 @@ describe('Test CLI wrapper', function () {
128 128
129 await waitJobs([ server ]) 129 await waitJobs([ server ])
130 130
131 const { total, data } = await server.videosCommand.list() 131 const { total, data } = await server.videos.list()
132 expect(total).to.equal(2) 132 expect(total).to.equal(2)
133 133
134 const video = data.find(v => v.name === 'small video - youtube') 134 const video = data.find(v => v.name === 'small video - youtube')
135 expect(video).to.not.be.undefined 135 expect(video).to.not.be.undefined
136 136
137 const videoDetails = await server.videosCommand.get({ id: video.id }) 137 const videoDetails = await server.videos.get({ id: video.id })
138 expect(videoDetails.channel.name).to.equal('user_channel') 138 expect(videoDetails.channel.name).to.equal('user_channel')
139 expect(videoDetails.support).to.equal('super support text') 139 expect(videoDetails.support).to.equal('super support text')
140 expect(videoDetails.nsfw).to.be.false 140 expect(videoDetails.nsfw).to.be.false
141 141
142 // So we can reimport it 142 // So we can reimport it
143 await server.videosCommand.remove({ token: userAccessToken, id: video.id }) 143 await server.videos.remove({ token: userAccessToken, id: video.id })
144 }) 144 })
145 145
146 it('Should import and override some imported attributes', async function () { 146 it('Should import and override some imported attributes', async function () {
@@ -155,13 +155,13 @@ describe('Test CLI wrapper', function () {
155 await waitJobs([ server ]) 155 await waitJobs([ server ])
156 156
157 { 157 {
158 const { total, data } = await server.videosCommand.list() 158 const { total, data } = await server.videos.list()
159 expect(total).to.equal(2) 159 expect(total).to.equal(2)
160 160
161 const video = data.find(v => v.name === 'toto') 161 const video = data.find(v => v.name === 'toto')
162 expect(video).to.not.be.undefined 162 expect(video).to.not.be.undefined
163 163
164 const videoDetails = await server.videosCommand.get({ id: video.id }) 164 const videoDetails = await server.videos.get({ id: video.id })
165 expect(videoDetails.channel.name).to.equal('user_channel') 165 expect(videoDetails.channel.name).to.equal('user_channel')
166 expect(videoDetails.support).to.equal('support') 166 expect(videoDetails.support).to.equal('support')
167 expect(videoDetails.nsfw).to.be.true 167 expect(videoDetails.nsfw).to.be.true
@@ -225,10 +225,10 @@ describe('Test CLI wrapper', function () {
225 servers = [ server, anotherServer ] 225 servers = [ server, anotherServer ]
226 await waitJobs(servers) 226 await waitJobs(servers)
227 227
228 const { uuid } = await anotherServer.videosCommand.quickUpload({ name: 'super video' }) 228 const { uuid } = await anotherServer.videos.quickUpload({ name: 'super video' })
229 await waitJobs(servers) 229 await waitJobs(servers)
230 230
231 video1Server2 = await server.videosCommand.getId({ uuid }) 231 video1Server2 = await server.videos.getId({ uuid })
232 }) 232 })
233 233
234 it('Should add a redundancy', async function () { 234 it('Should add a redundancy', async function () {
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts
index 5344bfc96..178a7a2d9 100644
--- a/server/tests/cli/plugins.ts
+++ b/server/tests/cli/plugins.ts
@@ -27,13 +27,13 @@ describe('Test plugin scripts', function () {
27 27
28 const packagePath = PluginsCommand.getPluginTestPath() 28 const packagePath = PluginsCommand.getPluginTestPath()
29 29
30 await server.cliCommand.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`) 30 await server.cli.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`)
31 }) 31 })
32 32
33 it('Should install a theme from stateless CLI', async function () { 33 it('Should install a theme from stateless CLI', async function () {
34 this.timeout(60000) 34 this.timeout(60000)
35 35
36 await server.cliCommand.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`) 36 await server.cli.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`)
37 }) 37 })
38 38
39 it('Should have the theme and the plugin registered when we restart peertube', async function () { 39 it('Should have the theme and the plugin registered when we restart peertube', async function () {
@@ -42,7 +42,7 @@ describe('Test plugin scripts', function () {
42 await killallServers([ server ]) 42 await killallServers([ server ])
43 await reRunServer(server) 43 await reRunServer(server)
44 44
45 const config = await server.configCommand.getConfig() 45 const config = await server.config.getConfig()
46 46
47 const plugin = config.plugin.registered 47 const plugin = config.plugin.registered
48 .find(p => p.name === 'test') 48 .find(p => p.name === 'test')
@@ -56,7 +56,7 @@ describe('Test plugin scripts', function () {
56 it('Should uninstall a plugin from stateless CLI', async function () { 56 it('Should uninstall a plugin from stateless CLI', async function () {
57 this.timeout(60000) 57 this.timeout(60000)
58 58
59 await server.cliCommand.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`) 59 await server.cli.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`)
60 }) 60 })
61 61
62 it('Should have removed the plugin on another peertube restart', async function () { 62 it('Should have removed the plugin on another peertube restart', async function () {
@@ -65,7 +65,7 @@ describe('Test plugin scripts', function () {
65 await killallServers([ server ]) 65 await killallServers([ server ])
66 await reRunServer(server) 66 await reRunServer(server)
67 67
68 const config = await server.configCommand.getConfig() 68 const config = await server.config.getConfig()
69 69
70 const plugin = config.plugin.registered 70 const plugin = config.plugin.registered
71 .find(p => p.name === 'test') 71 .find(p => p.name === 'test')
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts
index a4556312b..9912a36e0 100644
--- a/server/tests/cli/prune-storage.ts
+++ b/server/tests/cli/prune-storage.ts
@@ -24,13 +24,13 @@ import { VideoPlaylistPrivacy } from '@shared/models'
24const expect = chai.expect 24const expect = chai.expect
25 25
26async function countFiles (server: ServerInfo, directory: string) { 26async function countFiles (server: ServerInfo, directory: string) {
27 const files = await readdir(server.serversCommand.buildDirectory(directory)) 27 const files = await readdir(server.servers.buildDirectory(directory))
28 28
29 return files.length 29 return files.length
30} 30}
31 31
32async function assertNotExists (server: ServerInfo, directory: string, substring: string) { 32async function assertNotExists (server: ServerInfo, directory: string, substring: string) {
33 const files = await readdir(server.serversCommand.buildDirectory(directory)) 33 const files = await readdir(server.servers.buildDirectory(directory))
34 34
35 for (const f of files) { 35 for (const f of files) {
36 expect(f).to.not.contain(substring) 36 expect(f).to.not.contain(substring)
@@ -68,16 +68,16 @@ describe('Test prune storage scripts', function () {
68 await setDefaultVideoChannel(servers) 68 await setDefaultVideoChannel(servers)
69 69
70 for (const server of servers) { 70 for (const server of servers) {
71 await server.videosCommand.upload({ attributes: { name: 'video 1' } }) 71 await server.videos.upload({ attributes: { name: 'video 1' } })
72 await server.videosCommand.upload({ attributes: { name: 'video 2' } }) 72 await server.videos.upload({ attributes: { name: 'video 2' } })
73 73
74 await server.usersCommand.updateMyAvatar({ fixture: 'avatar.png' }) 74 await server.users.updateMyAvatar({ fixture: 'avatar.png' })
75 75
76 await server.playlistsCommand.create({ 76 await server.playlists.create({
77 attributes: { 77 attributes: {
78 displayName: 'playlist', 78 displayName: 'playlist',
79 privacy: VideoPlaylistPrivacy.PUBLIC, 79 privacy: VideoPlaylistPrivacy.PUBLIC,
80 videoChannelId: server.videoChannel.id, 80 videoChannelId: server.store.channel.id,
81 thumbnailfile: 'thumbnail.jpg' 81 thumbnailfile: 'thumbnail.jpg'
82 } 82 }
83 }) 83 })
@@ -87,7 +87,7 @@ describe('Test prune storage scripts', function () {
87 87
88 // Lazy load the remote avatar 88 // Lazy load the remote avatar
89 { 89 {
90 const account = await servers[0].accountsCommand.get({ accountName: 'root@localhost:' + servers[1].port }) 90 const account = await servers[0].accounts.get({ accountName: 'root@localhost:' + servers[1].port })
91 await makeGetRequest({ 91 await makeGetRequest({
92 url: servers[0].url, 92 url: servers[0].url,
93 path: account.avatar.path, 93 path: account.avatar.path,
@@ -96,7 +96,7 @@ describe('Test prune storage scripts', function () {
96 } 96 }
97 97
98 { 98 {
99 const account = await servers[1].accountsCommand.get({ accountName: 'root@localhost:' + servers[0].port }) 99 const account = await servers[1].accounts.get({ accountName: 'root@localhost:' + servers[0].port })
100 await makeGetRequest({ 100 await makeGetRequest({
101 url: servers[1].url, 101 url: servers[1].url,
102 path: account.avatar.path, 102 path: account.avatar.path,
@@ -119,7 +119,7 @@ describe('Test prune storage scripts', function () {
119 it('Should create some dirty files', async function () { 119 it('Should create some dirty files', async function () {
120 for (let i = 0; i < 2; i++) { 120 for (let i = 0; i < 2; i++) {
121 { 121 {
122 const base = servers[0].serversCommand.buildDirectory('videos') 122 const base = servers[0].servers.buildDirectory('videos')
123 123
124 const n1 = buildUUID() + '.mp4' 124 const n1 = buildUUID() + '.mp4'
125 const n2 = buildUUID() + '.webm' 125 const n2 = buildUUID() + '.webm'
@@ -131,7 +131,7 @@ describe('Test prune storage scripts', function () {
131 } 131 }
132 132
133 { 133 {
134 const base = servers[0].serversCommand.buildDirectory('torrents') 134 const base = servers[0].servers.buildDirectory('torrents')
135 135
136 const n1 = buildUUID() + '-240.torrent' 136 const n1 = buildUUID() + '-240.torrent'
137 const n2 = buildUUID() + '-480.torrent' 137 const n2 = buildUUID() + '-480.torrent'
@@ -143,7 +143,7 @@ describe('Test prune storage scripts', function () {
143 } 143 }
144 144
145 { 145 {
146 const base = servers[0].serversCommand.buildDirectory('thumbnails') 146 const base = servers[0].servers.buildDirectory('thumbnails')
147 147
148 const n1 = buildUUID() + '.jpg' 148 const n1 = buildUUID() + '.jpg'
149 const n2 = buildUUID() + '.jpg' 149 const n2 = buildUUID() + '.jpg'
@@ -155,7 +155,7 @@ describe('Test prune storage scripts', function () {
155 } 155 }
156 156
157 { 157 {
158 const base = servers[0].serversCommand.buildDirectory('previews') 158 const base = servers[0].servers.buildDirectory('previews')
159 159
160 const n1 = buildUUID() + '.jpg' 160 const n1 = buildUUID() + '.jpg'
161 const n2 = buildUUID() + '.jpg' 161 const n2 = buildUUID() + '.jpg'
@@ -167,7 +167,7 @@ describe('Test prune storage scripts', function () {
167 } 167 }
168 168
169 { 169 {
170 const base = servers[0].serversCommand.buildDirectory('avatars') 170 const base = servers[0].servers.buildDirectory('avatars')
171 171
172 const n1 = buildUUID() + '.png' 172 const n1 = buildUUID() + '.png'
173 const n2 = buildUUID() + '.jpg' 173 const n2 = buildUUID() + '.jpg'
@@ -183,7 +183,7 @@ describe('Test prune storage scripts', function () {
183 it('Should run prune storage', async function () { 183 it('Should run prune storage', async function () {
184 this.timeout(30000) 184 this.timeout(30000)
185 185
186 const env = servers[0].cliCommand.getEnv() 186 const env = servers[0].cli.getEnv()
187 await CLICommand.exec(`echo y | ${env} npm run prune-storage`) 187 await CLICommand.exec(`echo y | ${env} npm run prune-storage`)
188 }) 188 })
189 189
diff --git a/server/tests/cli/regenerate-thumbnails.ts b/server/tests/cli/regenerate-thumbnails.ts
index d59520783..2df1a1157 100644
--- a/server/tests/cli/regenerate-thumbnails.ts
+++ b/server/tests/cli/regenerate-thumbnails.ts
@@ -15,7 +15,7 @@ import {
15} from '../../../shared/extra-utils' 15} from '../../../shared/extra-utils'
16 16
17async function testThumbnail (server: ServerInfo, videoId: number | string) { 17async function testThumbnail (server: ServerInfo, videoId: number | string) {
18 const video = await server.videosCommand.get({ id: videoId }) 18 const video = await server.videos.get({ id: videoId })
19 19
20 const requests = [ 20 const requests = [
21 makeRawRequest(join(server.url, video.thumbnailPath), HttpStatusCode.OK_200), 21 makeRawRequest(join(server.url, video.thumbnailPath), HttpStatusCode.OK_200),
@@ -47,22 +47,22 @@ describe('Test regenerate thumbnails script', function () {
47 await doubleFollow(servers[0], servers[1]) 47 await doubleFollow(servers[0], servers[1])
48 48
49 { 49 {
50 const videoUUID1 = (await servers[0].videosCommand.quickUpload({ name: 'video 1' })).uuid 50 const videoUUID1 = (await servers[0].videos.quickUpload({ name: 'video 1' })).uuid
51 video1 = await servers[0].videosCommand.get({ id: videoUUID1 }) 51 video1 = await servers[0].videos.get({ id: videoUUID1 })
52 52
53 thumbnail1Path = join(servers[0].serversCommand.buildDirectory('thumbnails'), basename(video1.thumbnailPath)) 53 thumbnail1Path = join(servers[0].servers.buildDirectory('thumbnails'), basename(video1.thumbnailPath))
54 54
55 const videoUUID2 = (await servers[0].videosCommand.quickUpload({ name: 'video 2' })).uuid 55 const videoUUID2 = (await servers[0].videos.quickUpload({ name: 'video 2' })).uuid
56 video2 = await servers[0].videosCommand.get({ id: videoUUID2 }) 56 video2 = await servers[0].videos.get({ id: videoUUID2 })
57 } 57 }
58 58
59 { 59 {
60 const videoUUID = (await servers[1].videosCommand.quickUpload({ name: 'video 3' })).uuid 60 const videoUUID = (await servers[1].videos.quickUpload({ name: 'video 3' })).uuid
61 await waitJobs(servers) 61 await waitJobs(servers)
62 62
63 remoteVideo = await servers[0].videosCommand.get({ id: videoUUID }) 63 remoteVideo = await servers[0].videos.get({ id: videoUUID })
64 64
65 thumbnailRemotePath = join(servers[0].serversCommand.buildDirectory('thumbnails'), basename(remoteVideo.thumbnailPath)) 65 thumbnailRemotePath = join(servers[0].servers.buildDirectory('thumbnails'), basename(remoteVideo.thumbnailPath))
66 } 66 }
67 67
68 await writeFile(thumbnail1Path, '') 68 await writeFile(thumbnail1Path, '')
@@ -89,7 +89,7 @@ describe('Test regenerate thumbnails script', function () {
89 it('Should regenerate local thumbnails from the CLI', async function () { 89 it('Should regenerate local thumbnails from the CLI', async function () {
90 this.timeout(15000) 90 this.timeout(15000)
91 91
92 await servers[0].cliCommand.execWithEnv(`npm run regenerate-thumbnails`) 92 await servers[0].cli.execWithEnv(`npm run regenerate-thumbnails`)
93 }) 93 })
94 94
95 it('Should have generated new thumbnail files', async function () { 95 it('Should have generated new thumbnail files', async function () {
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts
index 5e1e1c2af..e0d6f220a 100644
--- a/server/tests/cli/reset-password.ts
+++ b/server/tests/cli/reset-password.ts
@@ -9,16 +9,16 @@ describe('Test reset password scripts', function () {
9 server = await flushAndRunServer(1) 9 server = await flushAndRunServer(1)
10 await setAccessTokensToServers([ server ]) 10 await setAccessTokensToServers([ server ])
11 11
12 await server.usersCommand.create({ username: 'user_1', password: 'super password' }) 12 await server.users.create({ username: 'user_1', password: 'super password' })
13 }) 13 })
14 14
15 it('Should change the user password from CLI', async function () { 15 it('Should change the user password from CLI', async function () {
16 this.timeout(60000) 16 this.timeout(60000)
17 17
18 const env = server.cliCommand.getEnv() 18 const env = server.cli.getEnv()
19 await CLICommand.exec(`echo coucou | ${env} npm run reset-password -- -u user_1`) 19 await CLICommand.exec(`echo coucou | ${env} npm run reset-password -- -u user_1`)
20 20
21 await server.loginCommand.login({ user: { username: 'user_1', password: 'coucou' } }) 21 await server.login.login({ user: { username: 'user_1', password: 'coucou' } })
22 }) 22 })
23 23
24 after(async function () { 24 after(async function () {
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts
index d90b4a64d..d2d196456 100644
--- a/server/tests/cli/update-host.ts
+++ b/server/tests/cli/update-host.ts
@@ -30,11 +30,11 @@ describe('Test update host scripts', function () {
30 await setAccessTokensToServers([ server ]) 30 await setAccessTokensToServers([ server ])
31 31
32 // Upload two videos for our needs 32 // Upload two videos for our needs
33 const { uuid: video1UUID } = await server.videosCommand.upload() 33 const { uuid: video1UUID } = await server.videos.upload()
34 await server.videosCommand.upload() 34 await server.videos.upload()
35 35
36 // Create a user 36 // Create a user
37 await server.usersCommand.create({ username: 'toto', password: 'coucou' }) 37 await server.users.create({ username: 'toto', password: 'coucou' })
38 38
39 // Create channel 39 // Create channel
40 const videoChannel = { 40 const videoChannel = {
@@ -42,11 +42,11 @@ describe('Test update host scripts', function () {
42 displayName: 'second video channel', 42 displayName: 'second video channel',
43 description: 'super video channel description' 43 description: 'super video channel description'
44 } 44 }
45 await server.channelsCommand.create({ attributes: videoChannel }) 45 await server.channels.create({ attributes: videoChannel })
46 46
47 // Create comments 47 // Create comments
48 const text = 'my super first comment' 48 const text = 'my super first comment'
49 await server.commentsCommand.createThread({ videoId: video1UUID, text }) 49 await server.comments.createThread({ videoId: video1UUID, text })
50 50
51 await waitJobs(server) 51 await waitJobs(server)
52 }) 52 })
@@ -58,11 +58,11 @@ describe('Test update host scripts', function () {
58 // Run server with standard configuration 58 // Run server with standard configuration
59 await reRunServer(server) 59 await reRunServer(server)
60 60
61 await server.cliCommand.execWithEnv(`npm run update-host`) 61 await server.cli.execWithEnv(`npm run update-host`)
62 }) 62 })
63 63
64 it('Should have updated videos url', async function () { 64 it('Should have updated videos url', async function () {
65 const { total, data } = await server.videosCommand.list() 65 const { total, data } = await server.videos.list()
66 expect(total).to.equal(2) 66 expect(total).to.equal(2)
67 67
68 for (const video of data) { 68 for (const video of data) {
@@ -70,7 +70,7 @@ describe('Test update host scripts', function () {
70 70
71 expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid) 71 expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid)
72 72
73 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 73 const videoDetails = await server.videos.get({ id: video.uuid })
74 74
75 expect(videoDetails.trackerUrls[0]).to.include(server.host) 75 expect(videoDetails.trackerUrls[0]).to.include(server.host)
76 expect(videoDetails.streamingPlaylists[0].playlistUrl).to.include(server.host) 76 expect(videoDetails.streamingPlaylists[0].playlistUrl).to.include(server.host)
@@ -79,7 +79,7 @@ describe('Test update host scripts', function () {
79 }) 79 })
80 80
81 it('Should have updated video channels url', async function () { 81 it('Should have updated video channels url', async function () {
82 const { data, total } = await server.channelsCommand.list({ sort: '-name' }) 82 const { data, total } = await server.channels.list({ sort: '-name' })
83 expect(total).to.equal(3) 83 expect(total).to.equal(3)
84 84
85 for (const channel of data) { 85 for (const channel of data) {
@@ -90,7 +90,7 @@ describe('Test update host scripts', function () {
90 }) 90 })
91 91
92 it('Should have updated accounts url', async function () { 92 it('Should have updated accounts url', async function () {
93 const body = await server.accountsCommand.list() 93 const body = await server.accounts.list()
94 expect(body.total).to.equal(3) 94 expect(body.total).to.equal(3)
95 95
96 for (const account of body.data) { 96 for (const account of body.data) {
@@ -104,11 +104,11 @@ describe('Test update host scripts', function () {
104 it('Should have updated torrent hosts', async function () { 104 it('Should have updated torrent hosts', async function () {
105 this.timeout(30000) 105 this.timeout(30000)
106 106
107 const { data } = await server.videosCommand.list() 107 const { data } = await server.videos.list()
108 expect(data).to.have.lengthOf(2) 108 expect(data).to.have.lengthOf(2)
109 109
110 for (const video of data) { 110 for (const video of data) {
111 const videoDetails = await server.videosCommand.get({ id: video.id }) 111 const videoDetails = await server.videos.get({ id: video.id })
112 112
113 expect(videoDetails.files).to.have.lengthOf(4) 113 expect(videoDetails.files).to.have.lengthOf(4)
114 114