diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-13 18:17:05 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-14 16:03:09 +0100 |
commit | ac81d1a06d57b9ae86663831e7f5edcef57b0fa4 (patch) | |
tree | da31775c9533d3e270f68f921e146f086bf7c0b8 /server/tests/api | |
parent | e883399fa6caa56bb8519c9a2e22d88001f26661 (diff) | |
download | PeerTube-ac81d1a06d57b9ae86663831e7f5edcef57b0fa4.tar.gz PeerTube-ac81d1a06d57b9ae86663831e7f5edcef57b0fa4.tar.zst PeerTube-ac81d1a06d57b9ae86663831e7f5edcef57b0fa4.zip |
Add ability to set video thumbnail/preview
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/check-params/users.ts | 8 | ||||
-rw-r--r-- | server/tests/api/check-params/videos.ts | 150 | ||||
-rw-r--r-- | server/tests/api/fixtures/preview.jpg | bin | 0 -> 4215 bytes | |||
-rw-r--r-- | server/tests/api/fixtures/thumbnail.jpg | bin | 0 -> 1457 bytes | |||
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 16 |
5 files changed, 143 insertions, 31 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 0fbc414c9..d9dea0713 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -7,7 +7,7 @@ import { UserRole } from '../../../../shared' | |||
7 | 7 | ||
8 | import { | 8 | import { |
9 | createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, | 9 | createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, |
10 | makePostBodyRequest, makePostUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, | 10 | makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, |
11 | updateUser, uploadVideo, userLogin | 11 | updateUser, uploadVideo, userLogin |
12 | } from '../../utils' | 12 | } from '../../utils' |
13 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' | 13 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' |
@@ -273,7 +273,7 @@ describe('Test users API validators', function () { | |||
273 | const attaches = { | 273 | const attaches = { |
274 | 'avatarfile': join(__dirname, '..', 'fixtures', 'video_short.mp4') | 274 | 'avatarfile': join(__dirname, '..', 'fixtures', 'video_short.mp4') |
275 | } | 275 | } |
276 | await makePostUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) | 276 | await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) |
277 | }) | 277 | }) |
278 | 278 | ||
279 | it('Should fail with a big file', async function () { | 279 | it('Should fail with a big file', async function () { |
@@ -281,7 +281,7 @@ describe('Test users API validators', function () { | |||
281 | const attaches = { | 281 | const attaches = { |
282 | 'avatarfile': join(__dirname, '..', 'fixtures', 'avatar-big.png') | 282 | 'avatarfile': join(__dirname, '..', 'fixtures', 'avatar-big.png') |
283 | } | 283 | } |
284 | await makePostUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) | 284 | await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) |
285 | }) | 285 | }) |
286 | 286 | ||
287 | it('Should succeed with the correct params', async function () { | 287 | it('Should succeed with the correct params', async function () { |
@@ -289,7 +289,7 @@ describe('Test users API validators', function () { | |||
289 | const attaches = { | 289 | const attaches = { |
290 | 'avatarfile': join(__dirname, '..', 'fixtures', 'avatar.png') | 290 | 'avatarfile': join(__dirname, '..', 'fixtures', 'avatar.png') |
291 | } | 291 | } |
292 | await makePostUploadRequest({ | 292 | await makeUploadRequest({ |
293 | url: server.url, | 293 | url: server.url, |
294 | path: path + '/me/avatar/pick', | 294 | path: path + '/me/avatar/pick', |
295 | token: server.accessToken, | 295 | token: server.accessToken, |
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index f25e3f595..aa30b721b 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts | |||
@@ -7,7 +7,7 @@ import { join } from 'path' | |||
7 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' | 7 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' |
8 | import { | 8 | import { |
9 | createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, | 9 | createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, |
10 | makeGetRequest, makePostUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin | 10 | makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin |
11 | } from '../../utils' | 11 | } from '../../utils' |
12 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' | 12 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' |
13 | 13 | ||
@@ -111,91 +111,91 @@ describe('Test videos API validator', function () { | |||
111 | it('Should fail with nothing', async function () { | 111 | it('Should fail with nothing', async function () { |
112 | const fields = {} | 112 | const fields = {} |
113 | const attaches = {} | 113 | const attaches = {} |
114 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 114 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
115 | }) | 115 | }) |
116 | 116 | ||
117 | it('Should fail without name', async function () { | 117 | it('Should fail without name', async function () { |
118 | const fields = omit(baseCorrectParams, 'name') | 118 | const fields = omit(baseCorrectParams, 'name') |
119 | const attaches = baseCorrectAttaches | 119 | const attaches = baseCorrectAttaches |
120 | 120 | ||
121 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 121 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
122 | }) | 122 | }) |
123 | 123 | ||
124 | it('Should fail with a long name', async function () { | 124 | it('Should fail with a long name', async function () { |
125 | const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(65) }) | 125 | const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(65) }) |
126 | const attaches = baseCorrectAttaches | 126 | const attaches = baseCorrectAttaches |
127 | 127 | ||
128 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 128 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
129 | }) | 129 | }) |
130 | 130 | ||
131 | it('Should fail with a bad category', async function () { | 131 | it('Should fail with a bad category', async function () { |
132 | const fields = immutableAssign(baseCorrectParams, { category: 125 }) | 132 | const fields = immutableAssign(baseCorrectParams, { category: 125 }) |
133 | const attaches = baseCorrectAttaches | 133 | const attaches = baseCorrectAttaches |
134 | 134 | ||
135 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 135 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
136 | }) | 136 | }) |
137 | 137 | ||
138 | it('Should fail with a bad licence', async function () { | 138 | it('Should fail with a bad licence', async function () { |
139 | const fields = immutableAssign(baseCorrectParams, { licence: 125 }) | 139 | const fields = immutableAssign(baseCorrectParams, { licence: 125 }) |
140 | const attaches = baseCorrectAttaches | 140 | const attaches = baseCorrectAttaches |
141 | 141 | ||
142 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 142 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
143 | }) | 143 | }) |
144 | 144 | ||
145 | it('Should fail with a bad language', async function () { | 145 | it('Should fail with a bad language', async function () { |
146 | const fields = immutableAssign(baseCorrectParams, { language: 125 }) | 146 | const fields = immutableAssign(baseCorrectParams, { language: 125 }) |
147 | const attaches = baseCorrectAttaches | 147 | const attaches = baseCorrectAttaches |
148 | 148 | ||
149 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 149 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
150 | }) | 150 | }) |
151 | 151 | ||
152 | it('Should fail without nsfw attribute', async function () { | 152 | it('Should fail without nsfw attribute', async function () { |
153 | const fields = omit(baseCorrectParams, 'nsfw') | 153 | const fields = omit(baseCorrectParams, 'nsfw') |
154 | const attaches = baseCorrectAttaches | 154 | const attaches = baseCorrectAttaches |
155 | 155 | ||
156 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 156 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
157 | }) | 157 | }) |
158 | 158 | ||
159 | it('Should fail with a bad nsfw attribute', async function () { | 159 | it('Should fail with a bad nsfw attribute', async function () { |
160 | const fields = immutableAssign(baseCorrectParams, { nsfw: 2 }) | 160 | const fields = immutableAssign(baseCorrectParams, { nsfw: 2 }) |
161 | const attaches = baseCorrectAttaches | 161 | const attaches = baseCorrectAttaches |
162 | 162 | ||
163 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 163 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
164 | }) | 164 | }) |
165 | 165 | ||
166 | it('Should fail without commentsEnabled attribute', async function () { | 166 | it('Should fail without commentsEnabled attribute', async function () { |
167 | const fields = omit(baseCorrectParams, 'commentsEnabled') | 167 | const fields = omit(baseCorrectParams, 'commentsEnabled') |
168 | const attaches = baseCorrectAttaches | 168 | const attaches = baseCorrectAttaches |
169 | 169 | ||
170 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 170 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
171 | }) | 171 | }) |
172 | 172 | ||
173 | it('Should fail with a bad commentsEnabled attribute', async function () { | 173 | it('Should fail with a bad commentsEnabled attribute', async function () { |
174 | const fields = immutableAssign(baseCorrectParams, { commentsEnabled: 2 }) | 174 | const fields = immutableAssign(baseCorrectParams, { commentsEnabled: 2 }) |
175 | const attaches = baseCorrectAttaches | 175 | const attaches = baseCorrectAttaches |
176 | 176 | ||
177 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 177 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
178 | }) | 178 | }) |
179 | 179 | ||
180 | it('Should fail with a long description', async function () { | 180 | it('Should fail with a long description', async function () { |
181 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) }) | 181 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) }) |
182 | const attaches = baseCorrectAttaches | 182 | const attaches = baseCorrectAttaches |
183 | 183 | ||
184 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 184 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
185 | }) | 185 | }) |
186 | 186 | ||
187 | it('Should fail without a channel', async function () { | 187 | it('Should fail without a channel', async function () { |
188 | const fields = omit(baseCorrectParams, 'channelId') | 188 | const fields = omit(baseCorrectParams, 'channelId') |
189 | const attaches = baseCorrectAttaches | 189 | const attaches = baseCorrectAttaches |
190 | 190 | ||
191 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 191 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
192 | }) | 192 | }) |
193 | 193 | ||
194 | it('Should fail with a bad channel', async function () { | 194 | it('Should fail with a bad channel', async function () { |
195 | const fields = immutableAssign(baseCorrectParams, { channelId: 545454 }) | 195 | const fields = immutableAssign(baseCorrectParams, { channelId: 545454 }) |
196 | const attaches = baseCorrectAttaches | 196 | const attaches = baseCorrectAttaches |
197 | 197 | ||
198 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 198 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
199 | }) | 199 | }) |
200 | 200 | ||
201 | it('Should fail with another user channel', async function () { | 201 | it('Should fail with another user channel', async function () { |
@@ -212,34 +212,34 @@ describe('Test videos API validator', function () { | |||
212 | const fields = immutableAssign(baseCorrectParams, { channelId: customChannelId }) | 212 | const fields = immutableAssign(baseCorrectParams, { channelId: customChannelId }) |
213 | const attaches = baseCorrectAttaches | 213 | const attaches = baseCorrectAttaches |
214 | 214 | ||
215 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 215 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
216 | }) | 216 | }) |
217 | 217 | ||
218 | it('Should fail with too many tags', async function () { | 218 | it('Should fail with too many tags', async function () { |
219 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] }) | 219 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] }) |
220 | const attaches = baseCorrectAttaches | 220 | const attaches = baseCorrectAttaches |
221 | 221 | ||
222 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 222 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
223 | }) | 223 | }) |
224 | 224 | ||
225 | it('Should fail with a tag length too low', async function () { | 225 | it('Should fail with a tag length too low', async function () { |
226 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 't' ] }) | 226 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 't' ] }) |
227 | const attaches = baseCorrectAttaches | 227 | const attaches = baseCorrectAttaches |
228 | 228 | ||
229 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 229 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
230 | }) | 230 | }) |
231 | 231 | ||
232 | it('Should fail with a tag length too big', async function () { | 232 | it('Should fail with a tag length too big', async function () { |
233 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] }) | 233 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] }) |
234 | const attaches = baseCorrectAttaches | 234 | const attaches = baseCorrectAttaches |
235 | 235 | ||
236 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 236 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
237 | }) | 237 | }) |
238 | 238 | ||
239 | it('Should fail without an input file', async function () { | 239 | it('Should fail without an input file', async function () { |
240 | const fields = baseCorrectParams | 240 | const fields = baseCorrectParams |
241 | const attaches = {} | 241 | const attaches = {} |
242 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 242 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
243 | }) | 243 | }) |
244 | 244 | ||
245 | it('Should fail without an incorrect input file', async function () { | 245 | it('Should fail without an incorrect input file', async function () { |
@@ -247,7 +247,47 @@ describe('Test videos API validator', function () { | |||
247 | const attaches = { | 247 | const attaches = { |
248 | 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | 248 | 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') |
249 | } | 249 | } |
250 | await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 250 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
251 | }) | ||
252 | |||
253 | it('Should fail with an incorrect thumbnail file', async function () { | ||
254 | const fields = baseCorrectParams | ||
255 | const attaches = { | ||
256 | 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar.png'), | ||
257 | 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | ||
258 | } | ||
259 | |||
260 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | ||
261 | }) | ||
262 | |||
263 | it('Should fail with a big thumbnail file', async function () { | ||
264 | const fields = baseCorrectParams | ||
265 | const attaches = { | ||
266 | 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar-big.png'), | ||
267 | 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | ||
268 | } | ||
269 | |||
270 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | ||
271 | }) | ||
272 | |||
273 | it('Should fail with an incorrect preview file', async function () { | ||
274 | const fields = baseCorrectParams | ||
275 | const attaches = { | ||
276 | 'previewfile': join(__dirname, '..', 'fixtures', 'avatar.png'), | ||
277 | 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | ||
278 | } | ||
279 | |||
280 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | ||
281 | }) | ||
282 | |||
283 | it('Should fail with a big preview file', async function () { | ||
284 | const fields = baseCorrectParams | ||
285 | const attaches = { | ||
286 | 'previewfile': join(__dirname, '..', 'fixtures', 'avatar-big.png'), | ||
287 | 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | ||
288 | } | ||
289 | |||
290 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | ||
251 | }) | 291 | }) |
252 | 292 | ||
253 | it('Should succeed with the correct parameters', async function () { | 293 | it('Should succeed with the correct parameters', async function () { |
@@ -257,7 +297,7 @@ describe('Test videos API validator', function () { | |||
257 | 297 | ||
258 | { | 298 | { |
259 | const attaches = baseCorrectAttaches | 299 | const attaches = baseCorrectAttaches |
260 | await makePostUploadRequest({ | 300 | await makeUploadRequest({ |
261 | url: server.url, | 301 | url: server.url, |
262 | path: path + '/upload', | 302 | path: path + '/upload', |
263 | token: server.accessToken, | 303 | token: server.accessToken, |
@@ -272,7 +312,7 @@ describe('Test videos API validator', function () { | |||
272 | videofile: join(__dirname, '..', 'fixtures', 'video_short.mp4') | 312 | videofile: join(__dirname, '..', 'fixtures', 'video_short.mp4') |
273 | }) | 313 | }) |
274 | 314 | ||
275 | await makePostUploadRequest({ | 315 | await makeUploadRequest({ |
276 | url: server.url, | 316 | url: server.url, |
277 | path: path + '/upload', | 317 | path: path + '/upload', |
278 | token: server.accessToken, | 318 | token: server.accessToken, |
@@ -287,7 +327,7 @@ describe('Test videos API validator', function () { | |||
287 | videofile: join(__dirname, '..', 'fixtures', 'video_short.ogv') | 327 | videofile: join(__dirname, '..', 'fixtures', 'video_short.ogv') |
288 | }) | 328 | }) |
289 | 329 | ||
290 | await makePostUploadRequest({ | 330 | await makeUploadRequest({ |
291 | url: server.url, | 331 | url: server.url, |
292 | path: path + '/upload', | 332 | path: path + '/upload', |
293 | token: server.accessToken, | 333 | token: server.accessToken, |
@@ -400,6 +440,70 @@ describe('Test videos API validator', function () { | |||
400 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) | 440 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) |
401 | }) | 441 | }) |
402 | 442 | ||
443 | it('Should fail with an incorrect thumbnail file', async function () { | ||
444 | const fields = baseCorrectParams | ||
445 | const attaches = { | ||
446 | 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar.png') | ||
447 | } | ||
448 | |||
449 | await makeUploadRequest({ | ||
450 | url: server.url, | ||
451 | method: 'PUT', | ||
452 | path: path + videoId, | ||
453 | token: server.accessToken, | ||
454 | fields, | ||
455 | attaches | ||
456 | }) | ||
457 | }) | ||
458 | |||
459 | it('Should fail with a big thumbnail file', async function () { | ||
460 | const fields = baseCorrectParams | ||
461 | const attaches = { | ||
462 | 'thumbnailfile': join(__dirname, '..', 'fixtures', 'avatar-big.png') | ||
463 | } | ||
464 | |||
465 | await makeUploadRequest({ | ||
466 | url: server.url, | ||
467 | method: 'PUT', | ||
468 | path: path + videoId, | ||
469 | token: server.accessToken, | ||
470 | fields, | ||
471 | attaches | ||
472 | }) | ||
473 | }) | ||
474 | |||
475 | it('Should fail with an incorrect preview file', async function () { | ||
476 | const fields = baseCorrectParams | ||
477 | const attaches = { | ||
478 | 'previewfile': join(__dirname, '..', 'fixtures', 'avatar.png') | ||
479 | } | ||
480 | |||
481 | await makeUploadRequest({ | ||
482 | url: server.url, | ||
483 | method: 'PUT', | ||
484 | path: path + videoId, | ||
485 | token: server.accessToken, | ||
486 | fields, | ||
487 | attaches | ||
488 | }) | ||
489 | }) | ||
490 | |||
491 | it('Should fail with a big preview file', async function () { | ||
492 | const fields = baseCorrectParams | ||
493 | const attaches = { | ||
494 | 'previewfile': join(__dirname, '..', 'fixtures', 'avatar-big.png') | ||
495 | } | ||
496 | |||
497 | await makeUploadRequest({ | ||
498 | url: server.url, | ||
499 | method: 'PUT', | ||
500 | path: path + videoId, | ||
501 | token: server.accessToken, | ||
502 | fields, | ||
503 | attaches | ||
504 | }) | ||
505 | }) | ||
506 | |||
403 | it('Should fail with a video of another user') | 507 | it('Should fail with a video of another user') |
404 | 508 | ||
405 | it('Should fail with a video of another server') | 509 | it('Should fail with a video of another server') |
diff --git a/server/tests/api/fixtures/preview.jpg b/server/tests/api/fixtures/preview.jpg new file mode 100644 index 000000000..c40ece838 --- /dev/null +++ b/server/tests/api/fixtures/preview.jpg | |||
Binary files differ | |||
diff --git a/server/tests/api/fixtures/thumbnail.jpg b/server/tests/api/fixtures/thumbnail.jpg new file mode 100644 index 000000000..cc3af8a4a --- /dev/null +++ b/server/tests/api/fixtures/thumbnail.jpg | |||
Binary files differ | |||
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 0215b3011..3646fbb0f 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -137,7 +137,9 @@ describe('Test multiple servers', function () { | |||
137 | nsfw: true, | 137 | nsfw: true, |
138 | description: 'my super description for server 2', | 138 | description: 'my super description for server 2', |
139 | tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], | 139 | tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], |
140 | fixture: 'video_short2.webm' | 140 | fixture: 'video_short2.webm', |
141 | thumbnailfile: 'thumbnail.jpg', | ||
142 | previewfile: 'preview.jpg' | ||
141 | } | 143 | } |
142 | await uploadVideo(servers[1].url, userAccessToken, videoAttributes) | 144 | await uploadVideo(servers[1].url, userAccessToken, videoAttributes) |
143 | 145 | ||
@@ -184,7 +186,9 @@ describe('Test multiple servers', function () { | |||
184 | resolution: 720, | 186 | resolution: 720, |
185 | size: 710000 | 187 | size: 710000 |
186 | } | 188 | } |
187 | ] | 189 | ], |
190 | thumbnailfile: 'thumbnail', | ||
191 | previewfile: 'preview' | ||
188 | } | 192 | } |
189 | 193 | ||
190 | const res = await getVideosList(server.url) | 194 | const res = await getVideosList(server.url) |
@@ -521,7 +525,9 @@ describe('Test multiple servers', function () { | |||
521 | language: 13, | 525 | language: 13, |
522 | nsfw: true, | 526 | nsfw: true, |
523 | description: 'my super description updated', | 527 | description: 'my super description updated', |
524 | tags: [ 'tag_up_1', 'tag_up_2' ] | 528 | tags: [ 'tag_up_1', 'tag_up_2' ], |
529 | thumbnailfile: 'thumbnail.jpg', | ||
530 | previewfile: 'preview.jpg' | ||
525 | } | 531 | } |
526 | 532 | ||
527 | await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes) | 533 | await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes) |
@@ -565,7 +571,9 @@ describe('Test multiple servers', function () { | |||
565 | resolution: 720, | 571 | resolution: 720, |
566 | size: 292677 | 572 | size: 292677 |
567 | } | 573 | } |
568 | ] | 574 | ], |
575 | thumbnailfile: 'thumbnail', | ||
576 | previewfile: 'preview' | ||
569 | } | 577 | } |
570 | await completeVideoCheck(server.url, videoUpdated, checkAttributes) | 578 | await completeVideoCheck(server.url, videoUpdated, checkAttributes) |
571 | } | 579 | } |