aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/plugin-helpers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins/plugin-helpers.ts')
-rw-r--r--server/tests/plugins/plugin-helpers.ts42
1 files changed, 21 insertions, 21 deletions
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 509aba13d..cf16aaa9d 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -39,28 +39,28 @@ describe('Test plugin helpers', function () {
39 39
40 await doubleFollow(servers[0], servers[1]) 40 await doubleFollow(servers[0], servers[1])
41 41
42 await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-four') }) 42 await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-four') })
43 }) 43 })
44 44
45 describe('Logger', function () { 45 describe('Logger', function () {
46 46
47 it('Should have logged things', async function () { 47 it('Should have logged things', async function () {
48 await servers[0].serversCommand.waitUntilLog('localhost:' + servers[0].port + ' peertube-plugin-test-four', 1, false) 48 await servers[0].servers.waitUntilLog('localhost:' + servers[0].port + ' peertube-plugin-test-four', 1, false)
49 await servers[0].serversCommand.waitUntilLog('Hello world from plugin four', 1) 49 await servers[0].servers.waitUntilLog('Hello world from plugin four', 1)
50 }) 50 })
51 }) 51 })
52 52
53 describe('Database', function () { 53 describe('Database', function () {
54 54
55 it('Should have made a query', async function () { 55 it('Should have made a query', async function () {
56 await servers[0].serversCommand.waitUntilLog(`root email is admin${servers[0].internalServerNumber}@example.com`) 56 await servers[0].servers.waitUntilLog(`root email is admin${servers[0].internalServerNumber}@example.com`)
57 }) 57 })
58 }) 58 })
59 59
60 describe('Config', function () { 60 describe('Config', function () {
61 61
62 it('Should have the correct webserver url', async function () { 62 it('Should have the correct webserver url', async function () {
63 await servers[0].serversCommand.waitUntilLog(`server url is http://localhost:${servers[0].port}`) 63 await servers[0].servers.waitUntilLog(`server url is http://localhost:${servers[0].port}`)
64 }) 64 })
65 65
66 it('Should have the correct config', async function () { 66 it('Should have the correct config', async function () {
@@ -78,7 +78,7 @@ describe('Test plugin helpers', function () {
78 describe('Server', function () { 78 describe('Server', function () {
79 79
80 it('Should get the server actor', async function () { 80 it('Should get the server actor', async function () {
81 await servers[0].serversCommand.waitUntilLog('server actor name is peertube') 81 await servers[0].servers.waitUntilLog('server actor name is peertube')
82 }) 82 })
83 }) 83 })
84 84
@@ -140,17 +140,17 @@ describe('Test plugin helpers', function () {
140 this.timeout(60000) 140 this.timeout(60000)
141 141
142 { 142 {
143 const res = await await servers[0].videosCommand.quickUpload({ name: 'video server 1' }) 143 const res = await await servers[0].videos.quickUpload({ name: 'video server 1' })
144 videoUUIDServer1 = res.uuid 144 videoUUIDServer1 = res.uuid
145 } 145 }
146 146
147 { 147 {
148 await await servers[1].videosCommand.quickUpload({ name: 'video server 2' }) 148 await await servers[1].videos.quickUpload({ name: 'video server 2' })
149 } 149 }
150 150
151 await waitJobs(servers) 151 await waitJobs(servers)
152 152
153 const { data } = await servers[0].videosCommand.list() 153 const { data } = await servers[0].videos.list()
154 154
155 expect(data).to.have.lengthOf(2) 155 expect(data).to.have.lengthOf(2)
156 }) 156 })
@@ -159,7 +159,7 @@ describe('Test plugin helpers', function () {
159 this.timeout(10000) 159 this.timeout(10000)
160 await postCommand(servers[0], 'blockServer', { hostToBlock: `localhost:${servers[1].port}` }) 160 await postCommand(servers[0], 'blockServer', { hostToBlock: `localhost:${servers[1].port}` })
161 161
162 const { data } = await servers[0].videosCommand.list() 162 const { data } = await servers[0].videos.list()
163 163
164 expect(data).to.have.lengthOf(1) 164 expect(data).to.have.lengthOf(1)
165 expect(data[0].name).to.equal('video server 1') 165 expect(data[0].name).to.equal('video server 1')
@@ -168,7 +168,7 @@ describe('Test plugin helpers', function () {
168 it('Should unmute server 2', async function () { 168 it('Should unmute server 2', async function () {
169 await postCommand(servers[0], 'unblockServer', { hostToUnblock: `localhost:${servers[1].port}` }) 169 await postCommand(servers[0], 'unblockServer', { hostToUnblock: `localhost:${servers[1].port}` })
170 170
171 const { data } = await servers[0].videosCommand.list() 171 const { data } = await servers[0].videos.list()
172 172
173 expect(data).to.have.lengthOf(2) 173 expect(data).to.have.lengthOf(2)
174 }) 174 })
@@ -176,7 +176,7 @@ describe('Test plugin helpers', function () {
176 it('Should mute account of server 2', async function () { 176 it('Should mute account of server 2', async function () {
177 await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@localhost:${servers[1].port}` }) 177 await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@localhost:${servers[1].port}` })
178 178
179 const { data } = await servers[0].videosCommand.list() 179 const { data } = await servers[0].videos.list()
180 180
181 expect(data).to.have.lengthOf(1) 181 expect(data).to.have.lengthOf(1)
182 expect(data[0].name).to.equal('video server 1') 182 expect(data[0].name).to.equal('video server 1')
@@ -185,7 +185,7 @@ describe('Test plugin helpers', function () {
185 it('Should unmute account of server 2', async function () { 185 it('Should unmute account of server 2', async function () {
186 await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@localhost:${servers[1].port}` }) 186 await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@localhost:${servers[1].port}` })
187 187
188 const { data } = await servers[0].videosCommand.list() 188 const { data } = await servers[0].videos.list()
189 189
190 expect(data).to.have.lengthOf(2) 190 expect(data).to.have.lengthOf(2)
191 }) 191 })
@@ -198,7 +198,7 @@ describe('Test plugin helpers', function () {
198 await waitJobs(servers) 198 await waitJobs(servers)
199 199
200 for (const server of servers) { 200 for (const server of servers) {
201 const { data } = await server.videosCommand.list() 201 const { data } = await server.videos.list()
202 202
203 expect(data).to.have.lengthOf(1) 203 expect(data).to.have.lengthOf(1)
204 expect(data[0].name).to.equal('video server 2') 204 expect(data[0].name).to.equal('video server 2')
@@ -213,7 +213,7 @@ describe('Test plugin helpers', function () {
213 await waitJobs(servers) 213 await waitJobs(servers)
214 214
215 for (const server of servers) { 215 for (const server of servers) {
216 const { data } = await server.videosCommand.list() 216 const { data } = await server.videos.list()
217 217
218 expect(data).to.have.lengthOf(2) 218 expect(data).to.have.lengthOf(2)
219 } 219 }
@@ -224,7 +224,7 @@ describe('Test plugin helpers', function () {
224 let videoUUID: string 224 let videoUUID: string
225 225
226 before(async () => { 226 before(async () => {
227 const res = await await servers[0].videosCommand.quickUpload({ name: 'video1' }) 227 const res = await await servers[0].videos.quickUpload({ name: 'video1' })
228 videoUUID = res.uuid 228 videoUUID = res.uuid
229 }) 229 })
230 230
@@ -232,15 +232,15 @@ describe('Test plugin helpers', function () {
232 this.timeout(40000) 232 this.timeout(40000)
233 233
234 // Should not throw -> video exists 234 // Should not throw -> video exists
235 await servers[0].videosCommand.get({ id: videoUUID }) 235 await servers[0].videos.get({ id: videoUUID })
236 // Should delete the video 236 // Should delete the video
237 await servers[0].videosCommand.view({ id: videoUUID }) 237 await servers[0].videos.view({ id: videoUUID })
238 238
239 await servers[0].serversCommand.waitUntilLog('Video deleted by plugin four.') 239 await servers[0].servers.waitUntilLog('Video deleted by plugin four.')
240 240
241 try { 241 try {
242 // Should throw because the video should have been deleted 242 // Should throw because the video should have been deleted
243 await servers[0].videosCommand.get({ id: videoUUID }) 243 await servers[0].videos.get({ id: videoUUID })
244 throw new Error('Video exists') 244 throw new Error('Video exists')
245 } catch (err) { 245 } catch (err) {
246 if (err.message.includes('exists')) throw err 246 if (err.message.includes('exists')) throw err
@@ -250,7 +250,7 @@ describe('Test plugin helpers', function () {
250 }) 250 })
251 251
252 it('Should have fetched the video by URL', async function () { 252 it('Should have fetched the video by URL', async function () {
253 await servers[0].serversCommand.waitUntilLog(`video from DB uuid is ${videoUUID}`) 253 await servers[0].servers.waitUntilLog(`video from DB uuid is ${videoUUID}`)
254 }) 254 })
255 }) 255 })
256 256