diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-11 09:21:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-11 09:21:13 +0200 |
commit | 784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428 (patch) | |
tree | 29c46cfd6344065eb805680ed080cb05592ee1d4 /server/tests/api/videos | |
parent | c3030e944ad03c7fd7b5d668a2d88ff03e4cdf19 (diff) | |
download | PeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.tar.gz PeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.tar.zst PeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.zip |
Prefer web videos in favour of webtorrent
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/video-files.ts | 34 | ||||
-rw-r--r-- | server/tests/api/videos/videos-common-filters.ts | 34 |
2 files changed, 34 insertions, 34 deletions
diff --git a/server/tests/api/videos/video-files.ts b/server/tests/api/videos/video-files.ts index 8c913bf31..0a183c44d 100644 --- a/server/tests/api/videos/video-files.ts +++ b/server/tests/api/videos/video-files.ts | |||
@@ -48,10 +48,10 @@ describe('Test videos files', function () { | |||
48 | await waitJobs(servers) | 48 | await waitJobs(servers) |
49 | }) | 49 | }) |
50 | 50 | ||
51 | it('Should delete webtorrent files', async function () { | 51 | it('Should delete web video files', async function () { |
52 | this.timeout(30_000) | 52 | this.timeout(30_000) |
53 | 53 | ||
54 | await servers[0].videos.removeAllWebTorrentFiles({ videoId: validId1 }) | 54 | await servers[0].videos.removeAllWebVideoFiles({ videoId: validId1 }) |
55 | 55 | ||
56 | await waitJobs(servers) | 56 | await waitJobs(servers) |
57 | 57 | ||
@@ -80,15 +80,15 @@ describe('Test videos files', function () { | |||
80 | }) | 80 | }) |
81 | 81 | ||
82 | describe('When deleting a specific file', function () { | 82 | describe('When deleting a specific file', function () { |
83 | let webtorrentId: string | 83 | let webVideoId: string |
84 | let hlsId: string | 84 | let hlsId: string |
85 | 85 | ||
86 | before(async function () { | 86 | before(async function () { |
87 | this.timeout(120_000) | 87 | this.timeout(120_000) |
88 | 88 | ||
89 | { | 89 | { |
90 | const { uuid } = await servers[0].videos.quickUpload({ name: 'webtorrent' }) | 90 | const { uuid } = await servers[0].videos.quickUpload({ name: 'web-video' }) |
91 | webtorrentId = uuid | 91 | webVideoId = uuid |
92 | } | 92 | } |
93 | 93 | ||
94 | { | 94 | { |
@@ -99,38 +99,38 @@ describe('Test videos files', function () { | |||
99 | await waitJobs(servers) | 99 | await waitJobs(servers) |
100 | }) | 100 | }) |
101 | 101 | ||
102 | it('Shoulde delete a webtorrent file', async function () { | 102 | it('Shoulde delete a web video file', async function () { |
103 | this.timeout(30_000) | 103 | this.timeout(30_000) |
104 | 104 | ||
105 | const video = await servers[0].videos.get({ id: webtorrentId }) | 105 | const video = await servers[0].videos.get({ id: webVideoId }) |
106 | const files = video.files | 106 | const files = video.files |
107 | 107 | ||
108 | await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentId, fileId: files[0].id }) | 108 | await servers[0].videos.removeWebVideoFile({ videoId: webVideoId, fileId: files[0].id }) |
109 | 109 | ||
110 | await waitJobs(servers) | 110 | await waitJobs(servers) |
111 | 111 | ||
112 | for (const server of servers) { | 112 | for (const server of servers) { |
113 | const video = await server.videos.get({ id: webtorrentId }) | 113 | const video = await server.videos.get({ id: webVideoId }) |
114 | 114 | ||
115 | expect(video.files).to.have.lengthOf(files.length - 1) | 115 | expect(video.files).to.have.lengthOf(files.length - 1) |
116 | expect(video.files.find(f => f.id === files[0].id)).to.not.exist | 116 | expect(video.files.find(f => f.id === files[0].id)).to.not.exist |
117 | } | 117 | } |
118 | }) | 118 | }) |
119 | 119 | ||
120 | it('Should delete all webtorrent files', async function () { | 120 | it('Should delete all web video files', async function () { |
121 | this.timeout(30_000) | 121 | this.timeout(30_000) |
122 | 122 | ||
123 | const video = await servers[0].videos.get({ id: webtorrentId }) | 123 | const video = await servers[0].videos.get({ id: webVideoId }) |
124 | const files = video.files | 124 | const files = video.files |
125 | 125 | ||
126 | for (const file of files) { | 126 | for (const file of files) { |
127 | await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentId, fileId: file.id }) | 127 | await servers[0].videos.removeWebVideoFile({ videoId: webVideoId, fileId: file.id }) |
128 | } | 128 | } |
129 | 129 | ||
130 | await waitJobs(servers) | 130 | await waitJobs(servers) |
131 | 131 | ||
132 | for (const server of servers) { | 132 | for (const server of servers) { |
133 | const video = await server.videos.get({ id: webtorrentId }) | 133 | const video = await server.videos.get({ id: webVideoId }) |
134 | 134 | ||
135 | expect(video.files).to.have.lengthOf(0) | 135 | expect(video.files).to.have.lengthOf(0) |
136 | } | 136 | } |
@@ -182,16 +182,16 @@ describe('Test videos files', function () { | |||
182 | it('Should not delete last file of a video', async function () { | 182 | it('Should not delete last file of a video', async function () { |
183 | this.timeout(60_000) | 183 | this.timeout(60_000) |
184 | 184 | ||
185 | const webtorrentOnly = await servers[0].videos.get({ id: hlsId }) | 185 | const webVideoOnly = await servers[0].videos.get({ id: hlsId }) |
186 | const hlsOnly = await servers[0].videos.get({ id: webtorrentId }) | 186 | const hlsOnly = await servers[0].videos.get({ id: webVideoId }) |
187 | 187 | ||
188 | for (let i = 0; i < 4; i++) { | 188 | for (let i = 0; i < 4; i++) { |
189 | await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentOnly.id, fileId: webtorrentOnly.files[i].id }) | 189 | await servers[0].videos.removeWebVideoFile({ videoId: webVideoOnly.id, fileId: webVideoOnly.files[i].id }) |
190 | await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[i].id }) | 190 | await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[i].id }) |
191 | } | 191 | } |
192 | 192 | ||
193 | const expectedStatus = HttpStatusCode.BAD_REQUEST_400 | 193 | const expectedStatus = HttpStatusCode.BAD_REQUEST_400 |
194 | await servers[0].videos.removeWebTorrentFile({ videoId: webtorrentOnly.id, fileId: webtorrentOnly.files[4].id, expectedStatus }) | 194 | await servers[0].videos.removeWebVideoFile({ videoId: webVideoOnly.id, fileId: webVideoOnly.files[4].id, expectedStatus }) |
195 | await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[4].id, expectedStatus }) | 195 | await servers[0].videos.removeHLSFile({ videoId: hlsOnly.id, fileId: hlsOnly.streamingPlaylists[0].files[4].id, expectedStatus }) |
196 | }) | 196 | }) |
197 | }) | 197 | }) |
diff --git a/server/tests/api/videos/videos-common-filters.ts b/server/tests/api/videos/videos-common-filters.ts index 30251706b..73c066bfb 100644 --- a/server/tests/api/videos/videos-common-filters.ts +++ b/server/tests/api/videos/videos-common-filters.ts | |||
@@ -154,7 +154,7 @@ describe('Test videos filter', function () { | |||
154 | server: PeerTubeServer | 154 | server: PeerTubeServer |
155 | path: string | 155 | path: string |
156 | isLocal?: boolean | 156 | isLocal?: boolean |
157 | hasWebtorrentFiles?: boolean | 157 | hasWebVideoFiles?: boolean |
158 | hasHLSFiles?: boolean | 158 | hasHLSFiles?: boolean |
159 | include?: VideoInclude | 159 | include?: VideoInclude |
160 | privacyOneOf?: VideoPrivacy[] | 160 | privacyOneOf?: VideoPrivacy[] |
@@ -174,7 +174,7 @@ describe('Test videos filter', function () { | |||
174 | 'include', | 174 | 'include', |
175 | 'category', | 175 | 'category', |
176 | 'tagsAllOf', | 176 | 'tagsAllOf', |
177 | 'hasWebtorrentFiles', | 177 | 'hasWebVideoFiles', |
178 | 'hasHLSFiles', | 178 | 'hasHLSFiles', |
179 | 'privacyOneOf', | 179 | 'privacyOneOf', |
180 | 'excludeAlreadyWatched' | 180 | 'excludeAlreadyWatched' |
@@ -463,14 +463,14 @@ describe('Test videos filter', function () { | |||
463 | } | 463 | } |
464 | }) | 464 | }) |
465 | 465 | ||
466 | it('Should filter by HLS or WebTorrent files', async function () { | 466 | it('Should filter by HLS or Web Video files', async function () { |
467 | this.timeout(360000) | 467 | this.timeout(360000) |
468 | 468 | ||
469 | const finderFactory = (name: string) => (videos: Video[]) => videos.some(v => v.name === name) | 469 | const finderFactory = (name: string) => (videos: Video[]) => videos.some(v => v.name === name) |
470 | 470 | ||
471 | await servers[0].config.enableTranscoding(true, false) | 471 | await servers[0].config.enableTranscoding(true, false) |
472 | await servers[0].videos.upload({ attributes: { name: 'webtorrent video' } }) | 472 | await servers[0].videos.upload({ attributes: { name: 'web video video' } }) |
473 | const hasWebtorrent = finderFactory('webtorrent video') | 473 | const hasWebVideo = finderFactory('web video video') |
474 | 474 | ||
475 | await waitJobs(servers) | 475 | await waitJobs(servers) |
476 | 476 | ||
@@ -481,24 +481,24 @@ describe('Test videos filter', function () { | |||
481 | await waitJobs(servers) | 481 | await waitJobs(servers) |
482 | 482 | ||
483 | await servers[0].config.enableTranscoding(true, true) | 483 | await servers[0].config.enableTranscoding(true, true) |
484 | await servers[0].videos.upload({ attributes: { name: 'hls and webtorrent video' } }) | 484 | await servers[0].videos.upload({ attributes: { name: 'hls and web video video' } }) |
485 | const hasBoth = finderFactory('hls and webtorrent video') | 485 | const hasBoth = finderFactory('hls and web video video') |
486 | 486 | ||
487 | await waitJobs(servers) | 487 | await waitJobs(servers) |
488 | 488 | ||
489 | for (const path of paths) { | 489 | for (const path of paths) { |
490 | { | 490 | { |
491 | const videos = await listVideos({ server: servers[0], path, hasWebtorrentFiles: true }) | 491 | const videos = await listVideos({ server: servers[0], path, hasWebVideoFiles: true }) |
492 | 492 | ||
493 | expect(hasWebtorrent(videos)).to.be.true | 493 | expect(hasWebVideo(videos)).to.be.true |
494 | expect(hasHLS(videos)).to.be.false | 494 | expect(hasHLS(videos)).to.be.false |
495 | expect(hasBoth(videos)).to.be.true | 495 | expect(hasBoth(videos)).to.be.true |
496 | } | 496 | } |
497 | 497 | ||
498 | { | 498 | { |
499 | const videos = await listVideos({ server: servers[0], path, hasWebtorrentFiles: false }) | 499 | const videos = await listVideos({ server: servers[0], path, hasWebVideoFiles: false }) |
500 | 500 | ||
501 | expect(hasWebtorrent(videos)).to.be.false | 501 | expect(hasWebVideo(videos)).to.be.false |
502 | expect(hasHLS(videos)).to.be.true | 502 | expect(hasHLS(videos)).to.be.true |
503 | expect(hasBoth(videos)).to.be.false | 503 | expect(hasBoth(videos)).to.be.false |
504 | } | 504 | } |
@@ -506,7 +506,7 @@ describe('Test videos filter', function () { | |||
506 | { | 506 | { |
507 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true }) | 507 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true }) |
508 | 508 | ||
509 | expect(hasWebtorrent(videos)).to.be.false | 509 | expect(hasWebVideo(videos)).to.be.false |
510 | expect(hasHLS(videos)).to.be.true | 510 | expect(hasHLS(videos)).to.be.true |
511 | expect(hasBoth(videos)).to.be.true | 511 | expect(hasBoth(videos)).to.be.true |
512 | } | 512 | } |
@@ -514,23 +514,23 @@ describe('Test videos filter', function () { | |||
514 | { | 514 | { |
515 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false }) | 515 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false }) |
516 | 516 | ||
517 | expect(hasWebtorrent(videos)).to.be.true | 517 | expect(hasWebVideo(videos)).to.be.true |
518 | expect(hasHLS(videos)).to.be.false | 518 | expect(hasHLS(videos)).to.be.false |
519 | expect(hasBoth(videos)).to.be.false | 519 | expect(hasBoth(videos)).to.be.false |
520 | } | 520 | } |
521 | 521 | ||
522 | { | 522 | { |
523 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false, hasWebtorrentFiles: false }) | 523 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: false, hasWebVideoFiles: false }) |
524 | 524 | ||
525 | expect(hasWebtorrent(videos)).to.be.false | 525 | expect(hasWebVideo(videos)).to.be.false |
526 | expect(hasHLS(videos)).to.be.false | 526 | expect(hasHLS(videos)).to.be.false |
527 | expect(hasBoth(videos)).to.be.false | 527 | expect(hasBoth(videos)).to.be.false |
528 | } | 528 | } |
529 | 529 | ||
530 | { | 530 | { |
531 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true, hasWebtorrentFiles: true }) | 531 | const videos = await listVideos({ server: servers[0], path, hasHLSFiles: true, hasWebVideoFiles: true }) |
532 | 532 | ||
533 | expect(hasWebtorrent(videos)).to.be.false | 533 | expect(hasWebVideo(videos)).to.be.false |
534 | expect(hasHLS(videos)).to.be.false | 534 | expect(hasHLS(videos)).to.be.false |
535 | expect(hasBoth(videos)).to.be.true | 535 | expect(hasBoth(videos)).to.be.true |
536 | } | 536 | } |