aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tests/api/check-params/upload-quota.ts6
-rw-r--r--server/tests/api/check-params/video-imports.ts6
-rw-r--r--server/tests/api/moderation/video-blacklist.ts8
-rw-r--r--server/tests/api/notifications/user-notifications.ts16
-rw-r--r--server/tests/api/videos/video-imports.ts18
-rw-r--r--server/tests/cli/peertube.ts8
-rw-r--r--server/tests/helpers/request.ts10
-rw-r--r--server/tests/plugins/filter-hooks.ts12
8 files changed, 42 insertions, 42 deletions
diff --git a/server/tests/api/check-params/upload-quota.ts b/server/tests/api/check-params/upload-quota.ts
index 2c73e6a19..bd8dce975 100644
--- a/server/tests/api/check-params/upload-quota.ts
+++ b/server/tests/api/check-params/upload-quota.ts
@@ -6,7 +6,7 @@ import { HttpStatusCode, randomInt } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 createSingleServer, 8 createSingleServer,
9 ImportsCommand, 9 FIXTURE_URLS,
10 PeerTubeServer, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 setDefaultVideoChannel, 12 setDefaultVideoChannel,
@@ -76,8 +76,8 @@ describe('Test upload quota', function () {
76 channelId: server.store.channel.id, 76 channelId: server.store.channel.id,
77 privacy: VideoPrivacy.PUBLIC 77 privacy: VideoPrivacy.PUBLIC
78 } 78 }
79 await server.imports.importVideo({ attributes: { ...baseAttributes, targetUrl: ImportsCommand.getGoodVideoUrl() } }) 79 await server.imports.importVideo({ attributes: { ...baseAttributes, targetUrl: FIXTURE_URLS.goodVideo } })
80 await server.imports.importVideo({ attributes: { ...baseAttributes, magnetUri: ImportsCommand.getMagnetURI() } }) 80 await server.imports.importVideo({ attributes: { ...baseAttributes, magnetUri: FIXTURE_URLS.magnet } })
81 await server.imports.importVideo({ attributes: { ...baseAttributes, torrentfile: 'video-720p.torrent' as any } }) 81 await server.imports.importVideo({ attributes: { ...baseAttributes, torrentfile: 'video-720p.torrent' as any } })
82 82
83 await waitJobs([ server ]) 83 await waitJobs([ server ])
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 627f0c7ad..0209275ac 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -10,7 +10,7 @@ import {
10 checkBadStartPagination, 10 checkBadStartPagination,
11 cleanupTests, 11 cleanupTests,
12 createSingleServer, 12 createSingleServer,
13 ImportsCommand, 13 FIXTURE_URLS,
14 makeGetRequest, 14 makeGetRequest,
15 makePostBodyRequest, 15 makePostBodyRequest,
16 makeUploadRequest, 16 makeUploadRequest,
@@ -70,7 +70,7 @@ describe('Test video imports API validator', function () {
70 70
71 before(function () { 71 before(function () {
72 baseCorrectParams = { 72 baseCorrectParams = {
73 targetUrl: ImportsCommand.getGoodVideoUrl(), 73 targetUrl: FIXTURE_URLS.goodVideo,
74 name: 'my super name', 74 name: 'my super name',
75 category: 5, 75 category: 5,
76 licence: 1, 76 licence: 1,
@@ -297,7 +297,7 @@ describe('Test video imports API validator', function () {
297 }) 297 })
298 298
299 let fields = omit(baseCorrectParams, 'targetUrl') 299 let fields = omit(baseCorrectParams, 'targetUrl')
300 fields = { ...fields, magnetUri: ImportsCommand.getMagnetURI() } 300 fields = { ...fields, magnetUri: FIXTURE_URLS.magnet }
301 301
302 await makePostBodyRequest({ 302 await makePostBodyRequest({
303 url: server.url, 303 url: server.url,
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts
index 62cbf2e07..d5838191a 100644
--- a/server/tests/api/moderation/video-blacklist.ts
+++ b/server/tests/api/moderation/video-blacklist.ts
@@ -6,9 +6,9 @@ import { orderBy } from 'lodash'
6import { 6import {
7 BlacklistCommand, 7 BlacklistCommand,
8 cleanupTests, 8 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 9 createMultipleServers,
11 ImportsCommand, 10 doubleFollow,
11 FIXTURE_URLS,
12 killallServers, 12 killallServers,
13 PeerTubeServer, 13 PeerTubeServer,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
@@ -387,7 +387,7 @@ describe('Test video blacklist', function () {
387 this.timeout(15000) 387 this.timeout(15000)
388 388
389 const attributes = { 389 const attributes = {
390 targetUrl: ImportsCommand.getGoodVideoUrl(), 390 targetUrl: FIXTURE_URLS.goodVideo,
391 name: 'URL import', 391 name: 'URL import',
392 channelId: channelOfUserWithoutFlag 392 channelId: channelOfUserWithoutFlag
393 } 393 }
@@ -400,7 +400,7 @@ describe('Test video blacklist', function () {
400 400
401 it('Should auto blacklist a video on torrent import', async function () { 401 it('Should auto blacklist a video on torrent import', async function () {
402 const attributes = { 402 const attributes = {
403 magnetUri: ImportsCommand.getMagnetURI(), 403 magnetUri: FIXTURE_URLS.magnet,
404 name: 'Torrent import', 404 name: 'Torrent import',
405 channelId: channelOfUserWithoutFlag 405 channelId: channelOfUserWithoutFlag
406 } 406 }
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index b7c22d118..ca592d466 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -10,10 +10,10 @@ import {
10 checkNewVideoFromSubscription, 10 checkNewVideoFromSubscription,
11 checkVideoIsPublished, 11 checkVideoIsPublished,
12 cleanupTests, 12 cleanupTests,
13 ImportsCommand, 13 FIXTURE_URLS,
14 MockSmtpServer, 14 MockSmtpServer,
15 prepareNotificationsTest,
16 PeerTubeServer, 15 PeerTubeServer,
16 prepareNotificationsTest,
17 uploadRandomVideoOnServers, 17 uploadRandomVideoOnServers,
18 wait, 18 wait,
19 waitJobs 19 waitJobs
@@ -205,7 +205,7 @@ describe('Test user notifications', function () {
205 name, 205 name,
206 channelId, 206 channelId,
207 privacy: VideoPrivacy.PUBLIC, 207 privacy: VideoPrivacy.PUBLIC,
208 targetUrl: ImportsCommand.getGoodVideoUrl() 208 targetUrl: FIXTURE_URLS.goodVideo
209 } 209 }
210 const { video } = await servers[0].imports.importVideo({ attributes }) 210 const { video } = await servers[0].imports.importVideo({ attributes })
211 211
@@ -275,7 +275,7 @@ describe('Test user notifications', function () {
275 name, 275 name,
276 channelId, 276 channelId,
277 privacy: VideoPrivacy.PUBLIC, 277 privacy: VideoPrivacy.PUBLIC,
278 targetUrl: ImportsCommand.getGoodVideoUrl(), 278 targetUrl: FIXTURE_URLS.goodVideo,
279 waitTranscoding: true 279 waitTranscoding: true
280 } 280 }
281 const { video } = await servers[1].imports.importVideo({ attributes }) 281 const { video } = await servers[1].imports.importVideo({ attributes })
@@ -343,12 +343,12 @@ describe('Test user notifications', function () {
343 name, 343 name,
344 channelId, 344 channelId,
345 privacy: VideoPrivacy.PRIVATE, 345 privacy: VideoPrivacy.PRIVATE,
346 targetUrl: ImportsCommand.getBadVideoUrl() 346 targetUrl: FIXTURE_URLS.badVideo
347 } 347 }
348 const { video } = await servers[0].imports.importVideo({ attributes }) 348 const { video } = await servers[0].imports.importVideo({ attributes })
349 349
350 await waitJobs(servers) 350 await waitJobs(servers)
351 await checkMyVideoImportIsFinished(baseParams, name, video.uuid, ImportsCommand.getBadVideoUrl(), false, 'presence') 351 await checkMyVideoImportIsFinished(baseParams, name, video.uuid, FIXTURE_URLS.badVideo, false, 'presence')
352 }) 352 })
353 353
354 it('Should send a notification when the video import succeeded', async function () { 354 it('Should send a notification when the video import succeeded', async function () {
@@ -360,12 +360,12 @@ describe('Test user notifications', function () {
360 name, 360 name,
361 channelId, 361 channelId,
362 privacy: VideoPrivacy.PRIVATE, 362 privacy: VideoPrivacy.PRIVATE,
363 targetUrl: ImportsCommand.getGoodVideoUrl() 363 targetUrl: FIXTURE_URLS.goodVideo
364 } 364 }
365 const { video } = await servers[0].imports.importVideo({ attributes }) 365 const { video } = await servers[0].imports.importVideo({ attributes })
366 366
367 await waitJobs(servers) 367 await waitJobs(servers)
368 await checkMyVideoImportIsFinished(baseParams, name, video.uuid, ImportsCommand.getGoodVideoUrl(), true, 'presence') 368 await checkMyVideoImportIsFinished(baseParams, name, video.uuid, FIXTURE_URLS.goodVideo, true, 'presence')
369 }) 369 })
370 }) 370 })
371 371
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 4ef55c3af..192f5232e 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -5,9 +5,9 @@ import * as chai from 'chai'
5import { 5import {
6 areHttpImportTestsDisabled, 6 areHttpImportTestsDisabled,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 8 createMultipleServers,
10 ImportsCommand, 9 doubleFollow,
10 FIXTURE_URLS,
11 PeerTubeServer, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 testCaptionFile, 13 testCaptionFile,
@@ -110,7 +110,7 @@ describe('Test video imports', function () {
110 } 110 }
111 111
112 { 112 {
113 const attributes = { ...baseAttributes, targetUrl: ImportsCommand.getYoutubeVideoUrl() } 113 const attributes = { ...baseAttributes, targetUrl: FIXTURE_URLS.youtube }
114 const { video } = await servers[0].imports.importVideo({ attributes }) 114 const { video } = await servers[0].imports.importVideo({ attributes })
115 expect(video.name).to.equal('small video - youtube') 115 expect(video.name).to.equal('small video - youtube')
116 116
@@ -162,7 +162,7 @@ Ajouter un sous-titre est vraiment facile`)
162 { 162 {
163 const attributes = { 163 const attributes = {
164 ...baseAttributes, 164 ...baseAttributes,
165 magnetUri: ImportsCommand.getMagnetURI(), 165 magnetUri: FIXTURE_URLS.magnet,
166 description: 'this is a super torrent description', 166 description: 'this is a super torrent description',
167 tags: [ 'tag_torrent1', 'tag_torrent2' ] 167 tags: [ 'tag_torrent1', 'tag_torrent2' ]
168 } 168 }
@@ -199,13 +199,13 @@ Ajouter un sous-titre est vraiment facile`)
199 199
200 expect(videoImports).to.have.lengthOf(3) 200 expect(videoImports).to.have.lengthOf(3)
201 201
202 expect(videoImports[2].targetUrl).to.equal(ImportsCommand.getYoutubeVideoUrl()) 202 expect(videoImports[2].targetUrl).to.equal(FIXTURE_URLS.youtube)
203 expect(videoImports[2].magnetUri).to.be.null 203 expect(videoImports[2].magnetUri).to.be.null
204 expect(videoImports[2].torrentName).to.be.null 204 expect(videoImports[2].torrentName).to.be.null
205 expect(videoImports[2].video.name).to.equal('small video - youtube') 205 expect(videoImports[2].video.name).to.equal('small video - youtube')
206 206
207 expect(videoImports[1].targetUrl).to.be.null 207 expect(videoImports[1].targetUrl).to.be.null
208 expect(videoImports[1].magnetUri).to.equal(ImportsCommand.getMagnetURI()) 208 expect(videoImports[1].magnetUri).to.equal(FIXTURE_URLS.magnet)
209 expect(videoImports[1].torrentName).to.be.null 209 expect(videoImports[1].torrentName).to.be.null
210 expect(videoImports[1].video.name).to.equal('super peertube2 video') 210 expect(videoImports[1].video.name).to.equal('super peertube2 video')
211 211
@@ -234,7 +234,7 @@ Ajouter un sous-titre est vraiment facile`)
234 this.timeout(60_000) 234 this.timeout(60_000)
235 235
236 const attributes = { 236 const attributes = {
237 targetUrl: ImportsCommand.getYoutubeVideoUrl(), 237 targetUrl: FIXTURE_URLS.youtube,
238 channelId: channelIdServer2, 238 channelId: channelIdServer2,
239 privacy: VideoPrivacy.PUBLIC, 239 privacy: VideoPrivacy.PUBLIC,
240 category: 10, 240 category: 10,
@@ -270,7 +270,7 @@ Ajouter un sous-titre est vraiment facile`)
270 270
271 const attributes = { 271 const attributes = {
272 name: 'transcoded video', 272 name: 'transcoded video',
273 magnetUri: ImportsCommand.getMagnetURI(), 273 magnetUri: FIXTURE_URLS.magnet,
274 channelId: channelIdServer2, 274 channelId: channelIdServer2,
275 privacy: VideoPrivacy.PUBLIC 275 privacy: VideoPrivacy.PUBLIC
276 } 276 }
@@ -320,7 +320,7 @@ Ajouter un sous-titre est vraiment facile`)
320 320
321 const attributes = { 321 const attributes = {
322 name: 'hdr video', 322 name: 'hdr video',
323 targetUrl: ImportsCommand.getYoutubeHDRVideoUrl(), 323 targetUrl: FIXTURE_URLS.youtubeHDR,
324 channelId: channelIdServer1, 324 channelId: channelIdServer1,
325 privacy: VideoPrivacy.PUBLIC 325 privacy: VideoPrivacy.PUBLIC
326 } 326 }
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index f19b6ae22..f2a984962 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -7,9 +7,9 @@ import {
7 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
8 cleanupTests, 8 cleanupTests,
9 CLICommand, 9 CLICommand,
10 doubleFollow,
11 createSingleServer, 10 createSingleServer,
12 ImportsCommand, 11 doubleFollow,
12 FIXTURE_URLS,
13 PeerTubeServer, 13 PeerTubeServer,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 testHelloWorldRegisteredSettings, 15 testHelloWorldRegisteredSettings,
@@ -117,7 +117,7 @@ describe('Test CLI wrapper', function () {
117 117
118 this.timeout(60000) 118 this.timeout(60000)
119 119
120 const params = `--target-url ${ImportsCommand.getYoutubeVideoUrl()} --channel-name user_channel` 120 const params = `--target-url ${FIXTURE_URLS.youtube} --channel-name user_channel`
121 await cliCommand.execWithEnv(`${cmd} import ${params}`) 121 await cliCommand.execWithEnv(`${cmd} import ${params}`)
122 }) 122 })
123 123
@@ -148,7 +148,7 @@ describe('Test CLI wrapper', function () {
148 148
149 this.timeout(60000) 149 this.timeout(60000)
150 150
151 const params = `--target-url ${ImportsCommand.getYoutubeVideoUrl()} ` + 151 const params = `--target-url ${FIXTURE_URLS.youtube} ` +
152 `--channel-name user_channel --video-name toto --nsfw --support support` 152 `--channel-name user_channel --video-name toto --nsfw --support support`
153 await cliCommand.execWithEnv(`${cmd} import ${params}`) 153 await cliCommand.execWithEnv(`${cmd} import ${params}`)
154 154
diff --git a/server/tests/helpers/request.ts b/server/tests/helpers/request.ts
index 5e77f129e..7f7873df3 100644
--- a/server/tests/helpers/request.ts
+++ b/server/tests/helpers/request.ts
@@ -4,7 +4,7 @@ import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { pathExists, remove } from 'fs-extra' 5import { pathExists, remove } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { get4KFileUrl, root, wait } from '../../../shared/extra-utils' 7import { FIXTURE_URLS, root, wait } from '../../../shared/extra-utils'
8import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests' 8import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests'
9 9
10describe('Request helpers', function () { 10describe('Request helpers', function () {
@@ -13,7 +13,7 @@ describe('Request helpers', function () {
13 13
14 it('Should throw an error when the bytes limit is exceeded for request', async function () { 14 it('Should throw an error when the bytes limit is exceeded for request', async function () {
15 try { 15 try {
16 await doRequest(get4KFileUrl(), { bodyKBLimit: 3 }) 16 await doRequest(FIXTURE_URLS.video4K, { bodyKBLimit: 3 })
17 } catch { 17 } catch {
18 return 18 return
19 } 19 }
@@ -23,7 +23,7 @@ describe('Request helpers', function () {
23 23
24 it('Should throw an error when the bytes limit is exceeded for request and save file', async function () { 24 it('Should throw an error when the bytes limit is exceeded for request and save file', async function () {
25 try { 25 try {
26 await doRequestAndSaveToFile(get4KFileUrl(), destPath1, { bodyKBLimit: 3 }) 26 await doRequestAndSaveToFile(FIXTURE_URLS.video4K, destPath1, { bodyKBLimit: 3 })
27 } catch { 27 } catch {
28 28
29 await wait(500) 29 await wait(500)
@@ -35,8 +35,8 @@ describe('Request helpers', function () {
35 }) 35 })
36 36
37 it('Should succeed if the file is below the limit', async function () { 37 it('Should succeed if the file is below the limit', async function () {
38 await doRequest(get4KFileUrl(), { bodyKBLimit: 5 }) 38 await doRequest(FIXTURE_URLS.video4K, { bodyKBLimit: 5 })
39 await doRequestAndSaveToFile(get4KFileUrl(), destPath2, { bodyKBLimit: 5 }) 39 await doRequestAndSaveToFile(FIXTURE_URLS.video4K, destPath2, { bodyKBLimit: 5 })
40 40
41 expect(await pathExists(destPath2)).to.be.true 41 expect(await pathExists(destPath2)).to.be.true
42 }) 42 })
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index 5d94303a9..df52bb3b5 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -5,12 +5,12 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 8 createMultipleServers,
10 ImportsCommand, 9 doubleFollow,
10 FIXTURE_URLS,
11 makeRawRequest, 11 makeRawRequest,
12 PluginsCommand,
13 PeerTubeServer, 12 PeerTubeServer,
13 PluginsCommand,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 setDefaultVideoChannel, 15 setDefaultVideoChannel,
16 waitJobs 16 waitJobs
@@ -136,7 +136,7 @@ describe('Test plugin filter hooks', function () {
136 name: 'normal title', 136 name: 'normal title',
137 privacy: VideoPrivacy.PUBLIC, 137 privacy: VideoPrivacy.PUBLIC,
138 channelId: servers[0].store.channel.id, 138 channelId: servers[0].store.channel.id,
139 targetUrl: ImportsCommand.getGoodVideoUrl() + 'bad' 139 targetUrl: FIXTURE_URLS.goodVideo + 'bad'
140 } 140 }
141 await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 141 await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
142 }) 142 })
@@ -161,7 +161,7 @@ describe('Test plugin filter hooks', function () {
161 name: 'title with bad word', 161 name: 'title with bad word',
162 privacy: VideoPrivacy.PUBLIC, 162 privacy: VideoPrivacy.PUBLIC,
163 channelId: servers[0].store.channel.id, 163 channelId: servers[0].store.channel.id,
164 targetUrl: ImportsCommand.getGoodVideoUrl() 164 targetUrl: FIXTURE_URLS.goodVideo
165 } 165 }
166 const body = await servers[0].imports.importVideo({ attributes }) 166 const body = await servers[0].imports.importVideo({ attributes })
167 videoImportId = body.id 167 videoImportId = body.id
@@ -273,7 +273,7 @@ describe('Test plugin filter hooks', function () {
273 273
274 const attributes = { 274 const attributes = {
275 name: 'video please blacklist me', 275 name: 'video please blacklist me',
276 targetUrl: ImportsCommand.getGoodVideoUrl(), 276 targetUrl: FIXTURE_URLS.goodVideo,
277 channelId: servers[0].store.channel.id 277 channelId: servers[0].store.channel.id
278 } 278 }
279 const body = await servers[0].imports.importVideo({ attributes }) 279 const body = await servers[0].imports.importVideo({ attributes })