aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/utils/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-28 11:14:26 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-03-18 11:17:59 +0100
commit07b1a18aa678d260009a93e36606c5c5f585723d (patch)
tree27a399fa0f7a29a7ac1d7d7cf077a24ea6ee39de /shared/utils/videos
parent418d092afa81e2c8fe8ac6838fc4b5eb0af6a782 (diff)
downloadPeerTube-07b1a18aa678d260009a93e36606c5c5f585723d.tar.gz
PeerTube-07b1a18aa678d260009a93e36606c5c5f585723d.tar.zst
PeerTube-07b1a18aa678d260009a93e36606c5c5f585723d.zip
Add playlist check param tests
Diffstat (limited to 'shared/utils/videos')
-rw-r--r--shared/utils/videos/video-playlists.ts30
1 files changed, 16 insertions, 14 deletions
diff --git a/shared/utils/videos/video-playlists.ts b/shared/utils/videos/video-playlists.ts
index 5186d9c4f..21285688a 100644
--- a/shared/utils/videos/video-playlists.ts
+++ b/shared/utils/videos/video-playlists.ts
@@ -31,7 +31,7 @@ function getVideoPlaylist (url: string, playlistId: number | string, statusCodeE
31 }) 31 })
32} 32}
33 33
34function deleteVideoPlaylist (url: string, token: string, playlistId: number | string, statusCodeExpected = 200) { 34function deleteVideoPlaylist (url: string, token: string, playlistId: number | string, statusCodeExpected = 204) {
35 const path = '/api/v1/video-playlists/' + playlistId 35 const path = '/api/v1/video-playlists/' + playlistId
36 36
37 return makeDeleteRequest({ 37 return makeDeleteRequest({
@@ -46,7 +46,7 @@ function createVideoPlaylist (options: {
46 url: string, 46 url: string,
47 token: string, 47 token: string,
48 playlistAttrs: VideoPlaylistCreate, 48 playlistAttrs: VideoPlaylistCreate,
49 expectedStatus: number 49 expectedStatus?: number
50}) { 50}) {
51 const path = '/api/v1/video-playlists/' 51 const path = '/api/v1/video-playlists/'
52 52
@@ -63,7 +63,7 @@ function createVideoPlaylist (options: {
63 token: options.token, 63 token: options.token,
64 fields, 64 fields,
65 attaches, 65 attaches,
66 statusCodeExpected: options.expectedStatus 66 statusCodeExpected: options.expectedStatus || 200
67 }) 67 })
68} 68}
69 69
@@ -71,9 +71,10 @@ function updateVideoPlaylist (options: {
71 url: string, 71 url: string,
72 token: string, 72 token: string,
73 playlistAttrs: VideoPlaylistUpdate, 73 playlistAttrs: VideoPlaylistUpdate,
74 expectedStatus: number 74 playlistId: number | string,
75 expectedStatus?: number
75}) { 76}) {
76 const path = '/api/v1/video-playlists/' 77 const path = '/api/v1/video-playlists/' + options.playlistId
77 78
78 const fields = omit(options.playlistAttrs, 'thumbnailfile') 79 const fields = omit(options.playlistAttrs, 'thumbnailfile')
79 80
@@ -88,7 +89,7 @@ function updateVideoPlaylist (options: {
88 token: options.token, 89 token: options.token,
89 fields, 90 fields,
90 attaches, 91 attaches,
91 statusCodeExpected: options.expectedStatus 92 statusCodeExpected: options.expectedStatus || 204
92 }) 93 })
93} 94}
94 95
@@ -97,7 +98,7 @@ function addVideoInPlaylist (options: {
97 token: string, 98 token: string,
98 playlistId: number | string, 99 playlistId: number | string,
99 elementAttrs: VideoPlaylistElementCreate 100 elementAttrs: VideoPlaylistElementCreate
100 expectedStatus: number 101 expectedStatus?: number
101}) { 102}) {
102 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos' 103 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos'
103 104
@@ -106,7 +107,7 @@ function addVideoInPlaylist (options: {
106 path, 107 path,
107 token: options.token, 108 token: options.token,
108 fields: options.elementAttrs, 109 fields: options.elementAttrs,
109 statusCodeExpected: options.expectedStatus 110 statusCodeExpected: options.expectedStatus || 200
110 }) 111 })
111} 112}
112 113
@@ -116,7 +117,7 @@ function updateVideoPlaylistElement (options: {
116 playlistId: number | string, 117 playlistId: number | string,
117 videoId: number | string, 118 videoId: number | string,
118 elementAttrs: VideoPlaylistElementUpdate, 119 elementAttrs: VideoPlaylistElementUpdate,
119 expectedStatus: number 120 expectedStatus?: number
120}) { 121}) {
121 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.videoId 122 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.videoId
122 123
@@ -125,7 +126,7 @@ function updateVideoPlaylistElement (options: {
125 path, 126 path,
126 token: options.token, 127 token: options.token,
127 fields: options.elementAttrs, 128 fields: options.elementAttrs,
128 statusCodeExpected: options.expectedStatus 129 statusCodeExpected: options.expectedStatus || 204
129 }) 130 })
130} 131}
131 132
@@ -142,7 +143,7 @@ function removeVideoFromPlaylist (options: {
142 url: options.url, 143 url: options.url,
143 path, 144 path,
144 token: options.token, 145 token: options.token,
145 statusCodeExpected: options.expectedStatus 146 statusCodeExpected: options.expectedStatus || 204
146 }) 147 })
147} 148}
148 149
@@ -152,14 +153,14 @@ function reorderVideosPlaylist (options: {
152 playlistId: number | string, 153 playlistId: number | string,
153 elementAttrs: { 154 elementAttrs: {
154 startPosition: number, 155 startPosition: number,
155 insertAfter: number, 156 insertAfterPosition: number,
156 reorderLength?: number 157 reorderLength?: number
157 }, 158 },
158 expectedStatus: number 159 expectedStatus: number
159}) { 160}) {
160 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos' 161 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/reorder'
161 162
162 return makePutBodyRequest({ 163 return makePostBodyRequest({
163 url: options.url, 164 url: options.url,
164 path, 165 path,
165 token: options.token, 166 token: options.token,
@@ -179,6 +180,7 @@ export {
179 deleteVideoPlaylist, 180 deleteVideoPlaylist,
180 181
181 addVideoInPlaylist, 182 addVideoInPlaylist,
183 updateVideoPlaylistElement,
182 removeVideoFromPlaylist, 184 removeVideoFromPlaylist,
183 185
184 reorderVideosPlaylist 186 reorderVideosPlaylist