aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 10:19:16 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit59bbcced37005dd511daca9bd58ae2998cb931b1 (patch)
tree60d1ba7a8b2eac691f27c25cb5e2d0ae3a510c9d /server/tests/api
parent254d3579f5338f5fd775c17d15cdfc37078bcfb4 (diff)
downloadPeerTube-59bbcced37005dd511daca9bd58ae2998cb931b1.tar.gz
PeerTube-59bbcced37005dd511daca9bd58ae2998cb931b1.tar.zst
PeerTube-59bbcced37005dd511daca9bd58ae2998cb931b1.zip
Centralize test URLs
Diffstat (limited to 'server/tests/api')
-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
5 files changed, 27 insertions, 27 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 }