diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-31 15:57:32 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-08-01 09:11:04 +0200 |
commit | bfbd912886eba17b4aa9a40dcef2fddc685d85bf (patch) | |
tree | 85e0f22980210a8ccd0888eb5e1790b152074677 /server/tests/api/check-params/videos-filter.ts | |
parent | 85394ba22a07bde1dfccebf3f591a5d6dbe9df56 (diff) | |
download | PeerTube-bfbd912886eba17b4aa9a40dcef2fddc685d85bf.tar.gz PeerTube-bfbd912886eba17b4aa9a40dcef2fddc685d85bf.tar.zst PeerTube-bfbd912886eba17b4aa9a40dcef2fddc685d85bf.zip |
Fix broken playlist api
Diffstat (limited to 'server/tests/api/check-params/videos-filter.ts')
-rw-r--r-- | server/tests/api/check-params/videos-filter.ts | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts index babef8223..5a5668665 100644 --- a/server/tests/api/check-params/videos-filter.ts +++ b/server/tests/api/check-params/videos-filter.ts | |||
@@ -15,13 +15,12 @@ import { | |||
15 | import { UserRole } from '../../../../shared/models/users' | 15 | import { UserRole } from '../../../../shared/models/users' |
16 | import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' | 16 | import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' |
17 | 17 | ||
18 | async function testEndpoints (server: ServerInfo, token: string, filter: string, playlistUUID: string, statusCodeExpected: number) { | 18 | async function testEndpoints (server: ServerInfo, token: string, filter: string, statusCodeExpected: number) { |
19 | const paths = [ | 19 | const paths = [ |
20 | '/api/v1/video-channels/root_channel/videos', | 20 | '/api/v1/video-channels/root_channel/videos', |
21 | '/api/v1/accounts/root/videos', | 21 | '/api/v1/accounts/root/videos', |
22 | '/api/v1/videos', | 22 | '/api/v1/videos', |
23 | '/api/v1/search/videos', | 23 | '/api/v1/search/videos' |
24 | '/api/v1/video-playlists/' + playlistUUID + '/videos' | ||
25 | ] | 24 | ] |
26 | 25 | ||
27 | for (const path of paths) { | 26 | for (const path of paths) { |
@@ -70,39 +69,28 @@ describe('Test videos filters', function () { | |||
70 | } | 69 | } |
71 | ) | 70 | ) |
72 | moderatorAccessToken = await userLogin(server, moderator) | 71 | moderatorAccessToken = await userLogin(server, moderator) |
73 | |||
74 | const res = await createVideoPlaylist({ | ||
75 | url: server.url, | ||
76 | token: server.accessToken, | ||
77 | playlistAttrs: { | ||
78 | displayName: 'super playlist', | ||
79 | privacy: VideoPlaylistPrivacy.PUBLIC, | ||
80 | videoChannelId: server.videoChannel.id | ||
81 | } | ||
82 | }) | ||
83 | playlistUUID = res.body.videoPlaylist.uuid | ||
84 | }) | 72 | }) |
85 | 73 | ||
86 | describe('When setting a video filter', function () { | 74 | describe('When setting a video filter', function () { |
87 | 75 | ||
88 | it('Should fail with a bad filter', async function () { | 76 | it('Should fail with a bad filter', async function () { |
89 | await testEndpoints(server, server.accessToken, 'bad-filter', playlistUUID, 400) | 77 | await testEndpoints(server, server.accessToken, 'bad-filter', 400) |
90 | }) | 78 | }) |
91 | 79 | ||
92 | it('Should succeed with a good filter', async function () { | 80 | it('Should succeed with a good filter', async function () { |
93 | await testEndpoints(server, server.accessToken,'local', playlistUUID, 200) | 81 | await testEndpoints(server, server.accessToken,'local', 200) |
94 | }) | 82 | }) |
95 | 83 | ||
96 | it('Should fail to list all-local with a simple user', async function () { | 84 | it('Should fail to list all-local with a simple user', async function () { |
97 | await testEndpoints(server, userAccessToken, 'all-local', playlistUUID, 401) | 85 | await testEndpoints(server, userAccessToken, 'all-local', 401) |
98 | }) | 86 | }) |
99 | 87 | ||
100 | it('Should succeed to list all-local with a moderator', async function () { | 88 | it('Should succeed to list all-local with a moderator', async function () { |
101 | await testEndpoints(server, moderatorAccessToken, 'all-local', playlistUUID, 200) | 89 | await testEndpoints(server, moderatorAccessToken, 'all-local', 200) |
102 | }) | 90 | }) |
103 | 91 | ||
104 | it('Should succeed to list all-local with an admin', async function () { | 92 | it('Should succeed to list all-local with an admin', async function () { |
105 | await testEndpoints(server, server.accessToken, 'all-local', playlistUUID, 200) | 93 | await testEndpoints(server, server.accessToken, 'all-local', 200) |
106 | }) | 94 | }) |
107 | 95 | ||
108 | // Because we cannot authenticate the user on the RSS endpoint | 96 | // Because we cannot authenticate the user on the RSS endpoint |