diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-06-21 15:31:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 15:31:25 +0200 |
commit | 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 (patch) | |
tree | eee1e6213ca4d635837ca01c2bdc5c876b8d8b7d /server/tests/api/check-params | |
parent | dec49521556fc228c6e05b6199e9b07f619b38fb (diff) | |
download | PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.gz PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.zst PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.zip |
store uploaded video filename (#4885)
* store uploaded video filename
closes #4731
* dont crash if videos channel exist
* migration: use raw query
* video source: fixes after code review
* cleanup
* bump migration
* updates after code review
* refactor: use checkUserCanManageVideo
* videoSource: add openapi doc
* test(check-params/video-source): fix timeout
* Styling
* Correctly set original filename as source
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r-- | server/tests/api/check-params/index.ts | 11 | ||||
-rw-r--r-- | server/tests/api/check-params/video-source.ts | 44 |
2 files changed, 50 insertions, 5 deletions
diff --git a/server/tests/api/check-params/index.ts b/server/tests/api/check-params/index.ts index 259d7e783..a27bc8509 100644 --- a/server/tests/api/check-params/index.ts +++ b/server/tests/api/check-params/index.ts | |||
@@ -3,14 +3,14 @@ import './accounts' | |||
3 | import './blocklist' | 3 | import './blocklist' |
4 | import './bulk' | 4 | import './bulk' |
5 | import './config' | 5 | import './config' |
6 | import './custom-pages' | ||
7 | import './contact-form' | 6 | import './contact-form' |
7 | import './custom-pages' | ||
8 | import './debug' | 8 | import './debug' |
9 | import './follows' | 9 | import './follows' |
10 | import './jobs' | 10 | import './jobs' |
11 | import './live' | ||
11 | import './logs' | 12 | import './logs' |
12 | import './my-user' | 13 | import './my-user' |
13 | import './live' | ||
14 | import './plugins' | 14 | import './plugins' |
15 | import './redundancy' | 15 | import './redundancy' |
16 | import './search' | 16 | import './search' |
@@ -25,12 +25,13 @@ import './video-blacklist' | |||
25 | import './video-captions' | 25 | import './video-captions' |
26 | import './video-channels' | 26 | import './video-channels' |
27 | import './video-comments' | 27 | import './video-comments' |
28 | import './video-studio' | 28 | import './video-files' |
29 | import './video-imports' | 29 | import './video-imports' |
30 | import './video-playlists' | 30 | import './video-playlists' |
31 | import './videos' | 31 | import './video-source' |
32 | import './video-studio' | ||
32 | import './videos-common-filters' | 33 | import './videos-common-filters' |
33 | import './video-files' | ||
34 | import './videos-history' | 34 | import './videos-history' |
35 | import './videos-overviews' | 35 | import './videos-overviews' |
36 | import './videos' | ||
36 | import './views' | 37 | import './views' |
diff --git a/server/tests/api/check-params/video-source.ts b/server/tests/api/check-params/video-source.ts new file mode 100644 index 000000000..ca324bb9d --- /dev/null +++ b/server/tests/api/check-params/video-source.ts | |||
@@ -0,0 +1,44 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | ||
2 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | ||
3 | |||
4 | describe('Test video sources API validator', function () { | ||
5 | let server: PeerTubeServer = null | ||
6 | let uuid: string | ||
7 | let userToken: string | ||
8 | |||
9 | before(async function () { | ||
10 | this.timeout(30000) | ||
11 | |||
12 | server = await createSingleServer(1) | ||
13 | await setAccessTokensToServers([ server ]) | ||
14 | |||
15 | const created = await server.videos.quickUpload({ name: 'video' }) | ||
16 | uuid = created.uuid | ||
17 | |||
18 | userToken = await server.users.generateUserAndToken('user') | ||
19 | }) | ||
20 | |||
21 | it('Should fail without a valid uuid', async function () { | ||
22 | await server.videos.getSource({ id: '4da6fde3-88f7-4d16-b119-108df563d0b0', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | ||
23 | }) | ||
24 | |||
25 | it('Should receive 404 when passing a non existing video id', async function () { | ||
26 | await server.videos.getSource({ id: '4da6fde3-88f7-4d16-b119-108df5630b06', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | ||
27 | }) | ||
28 | |||
29 | it('Should not get the source as unauthenticated', async function () { | ||
30 | await server.videos.getSource({ id: uuid, expectedStatus: HttpStatusCode.UNAUTHORIZED_401, token: null }) | ||
31 | }) | ||
32 | |||
33 | it('Should not get the source with another user', async function () { | ||
34 | await server.videos.getSource({ id: uuid, expectedStatus: HttpStatusCode.FORBIDDEN_403, token: userToken }) | ||
35 | }) | ||
36 | |||
37 | it('Should succeed with the correct parameters get the source as another user', async function () { | ||
38 | await server.videos.getSource({ id: uuid }) | ||
39 | }) | ||
40 | |||
41 | after(async function () { | ||
42 | await cleanupTests([ server ]) | ||
43 | }) | ||
44 | }) | ||