diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-12 16:09:02 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-10-24 14:48:24 +0200 |
commit | 3545e72c686ff1725bbdfd8d16d693e2f4aa75a3 (patch) | |
tree | e7f1d12ef5dae1e1142c3a8d0b681c1dbbb0de10 /server/tests/plugins | |
parent | 38a3ccc7f8ad0ea94362b58c732af7c387ab46be (diff) | |
download | PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.gz PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.zst PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.zip |
Put private videos under a specific subdirectory
Diffstat (limited to 'server/tests/plugins')
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 36 | ||||
-rw-r--r-- | server/tests/plugins/plugin-helpers.ts | 6 |
2 files changed, 27 insertions, 15 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index ae4b3cf5f..083fd43ca 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -6,6 +6,7 @@ import { | |||
6 | cleanupTests, | 6 | cleanupTests, |
7 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | makeGetRequest, | ||
9 | makeRawRequest, | 10 | makeRawRequest, |
10 | PeerTubeServer, | 11 | PeerTubeServer, |
11 | PluginsCommand, | 12 | PluginsCommand, |
@@ -461,30 +462,41 @@ describe('Test plugin filter hooks', function () { | |||
461 | }) | 462 | }) |
462 | 463 | ||
463 | it('Should run filter:api.download.torrent.allowed.result', async function () { | 464 | it('Should run filter:api.download.torrent.allowed.result', async function () { |
464 | const res = await makeRawRequest(downloadVideos[0].files[0].torrentDownloadUrl, 403) | 465 | const res = await makeRawRequest({ url: downloadVideos[0].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
465 | expect(res.body.error).to.equal('Liu Bei') | 466 | expect(res.body.error).to.equal('Liu Bei') |
466 | 467 | ||
467 | await makeRawRequest(downloadVideos[1].files[0].torrentDownloadUrl, 200) | 468 | await makeRawRequest({ url: downloadVideos[1].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.OK_200 }) |
468 | await makeRawRequest(downloadVideos[2].files[0].torrentDownloadUrl, 200) | 469 | await makeRawRequest({ url: downloadVideos[2].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.OK_200 }) |
469 | }) | 470 | }) |
470 | 471 | ||
471 | it('Should run filter:api.download.video.allowed.result', async function () { | 472 | it('Should run filter:api.download.video.allowed.result', async function () { |
472 | { | 473 | { |
473 | const res = await makeRawRequest(downloadVideos[1].files[0].fileDownloadUrl, 403) | 474 | const res = await makeRawRequest({ url: downloadVideos[1].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
474 | expect(res.body.error).to.equal('Cao Cao') | 475 | expect(res.body.error).to.equal('Cao Cao') |
475 | 476 | ||
476 | await makeRawRequest(downloadVideos[0].files[0].fileDownloadUrl, 200) | 477 | await makeRawRequest({ url: downloadVideos[0].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.OK_200 }) |
477 | await makeRawRequest(downloadVideos[2].files[0].fileDownloadUrl, 200) | 478 | await makeRawRequest({ url: downloadVideos[2].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.OK_200 }) |
478 | } | 479 | } |
479 | 480 | ||
480 | { | 481 | { |
481 | const res = await makeRawRequest(downloadVideos[2].streamingPlaylists[0].files[0].fileDownloadUrl, 403) | 482 | const res = await makeRawRequest({ |
483 | url: downloadVideos[2].streamingPlaylists[0].files[0].fileDownloadUrl, | ||
484 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | ||
485 | }) | ||
486 | |||
482 | expect(res.body.error).to.equal('Sun Jian') | 487 | expect(res.body.error).to.equal('Sun Jian') |
483 | 488 | ||
484 | await makeRawRequest(downloadVideos[2].files[0].fileDownloadUrl, 200) | 489 | await makeRawRequest({ url: downloadVideos[2].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.OK_200 }) |
490 | |||
491 | await makeRawRequest({ | ||
492 | url: downloadVideos[0].streamingPlaylists[0].files[0].fileDownloadUrl, | ||
493 | expectedStatus: HttpStatusCode.OK_200 | ||
494 | }) | ||
485 | 495 | ||
486 | await makeRawRequest(downloadVideos[0].streamingPlaylists[0].files[0].fileDownloadUrl, 200) | 496 | await makeRawRequest({ |
487 | await makeRawRequest(downloadVideos[1].streamingPlaylists[0].files[0].fileDownloadUrl, 200) | 497 | url: downloadVideos[1].streamingPlaylists[0].files[0].fileDownloadUrl, |
498 | expectedStatus: HttpStatusCode.OK_200 | ||
499 | }) | ||
488 | } | 500 | } |
489 | }) | 501 | }) |
490 | }) | 502 | }) |
@@ -515,12 +527,12 @@ describe('Test plugin filter hooks', function () { | |||
515 | }) | 527 | }) |
516 | 528 | ||
517 | it('Should run filter:html.embed.video.allowed.result', async function () { | 529 | it('Should run filter:html.embed.video.allowed.result', async function () { |
518 | const res = await makeRawRequest(servers[0].url + embedVideos[0].embedPath, 200) | 530 | const res = await makeGetRequest({ url: servers[0].url, path: embedVideos[0].embedPath, expectedStatus: HttpStatusCode.OK_200 }) |
519 | expect(res.text).to.equal('Lu Bu') | 531 | expect(res.text).to.equal('Lu Bu') |
520 | }) | 532 | }) |
521 | 533 | ||
522 | it('Should run filter:html.embed.video-playlist.allowed.result', async function () { | 534 | it('Should run filter:html.embed.video-playlist.allowed.result', async function () { |
523 | const res = await makeRawRequest(servers[0].url + embedPlaylists[0].embedPath, 200) | 535 | const res = await makeGetRequest({ url: servers[0].url, path: embedPlaylists[0].embedPath, expectedStatus: HttpStatusCode.OK_200 }) |
524 | expect(res.text).to.equal('Diao Chan') | 536 | expect(res.text).to.equal('Diao Chan') |
525 | }) | 537 | }) |
526 | }) | 538 | }) |
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts index 31c18350a..f2bada4ee 100644 --- a/server/tests/plugins/plugin-helpers.ts +++ b/server/tests/plugins/plugin-helpers.ts | |||
@@ -307,7 +307,7 @@ describe('Test plugin helpers', function () { | |||
307 | expect(file.fps).to.equal(25) | 307 | expect(file.fps).to.equal(25) |
308 | 308 | ||
309 | expect(await pathExists(file.path)).to.be.true | 309 | expect(await pathExists(file.path)).to.be.true |
310 | await makeRawRequest(file.url, HttpStatusCode.OK_200) | 310 | await makeRawRequest({ url: file.url, expectedStatus: HttpStatusCode.OK_200 }) |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
@@ -321,12 +321,12 @@ describe('Test plugin helpers', function () { | |||
321 | const miniature = body.thumbnails.find(t => t.type === ThumbnailType.MINIATURE) | 321 | const miniature = body.thumbnails.find(t => t.type === ThumbnailType.MINIATURE) |
322 | expect(miniature).to.exist | 322 | expect(miniature).to.exist |
323 | expect(await pathExists(miniature.path)).to.be.true | 323 | expect(await pathExists(miniature.path)).to.be.true |
324 | await makeRawRequest(miniature.url, HttpStatusCode.OK_200) | 324 | await makeRawRequest({ url: miniature.url, expectedStatus: HttpStatusCode.OK_200 }) |
325 | 325 | ||
326 | const preview = body.thumbnails.find(t => t.type === ThumbnailType.PREVIEW) | 326 | const preview = body.thumbnails.find(t => t.type === ThumbnailType.PREVIEW) |
327 | expect(preview).to.exist | 327 | expect(preview).to.exist |
328 | expect(await pathExists(preview.path)).to.be.true | 328 | expect(await pathExists(preview.path)).to.be.true |
329 | await makeRawRequest(preview.url, HttpStatusCode.OK_200) | 329 | await makeRawRequest({ url: preview.url, expectedStatus: HttpStatusCode.OK_200 }) |
330 | } | 330 | } |
331 | }) | 331 | }) |
332 | 332 | ||