aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/multiple-servers.ts73
-rw-r--r--server/tests/api/videos/services.ts4
-rw-r--r--server/tests/api/videos/single-server.ts42
3 files changed, 67 insertions, 52 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 27c4c30b8..3f6b82c50 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -8,13 +8,35 @@ import { VideoPrivacy } from '../../../../shared/models/videos'
8import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 8import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
9 9
10import { 10import {
11 addVideoChannel, checkVideoFilesWereRemoved, completeVideoCheck, createUser, dateIsValid, doubleFollow, flushAndRunMultipleServers, 11 addVideoChannel,
12 flushTests, getVideo, 12 checkVideoFilesWereRemoved,
13 getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testImage, 13 completeVideoCheck,
14 updateVideo, uploadVideo, userLogin, viewVideo, wait, webtorrentAdd 14 createUser,
15 dateIsValid,
16 doubleFollow,
17 flushAndRunMultipleServers,
18 flushTests,
19 getVideo,
20 getVideoChannelsList,
21 getVideosList,
22 killallServers,
23 rateVideo,
24 removeVideo,
25 ServerInfo,
26 setAccessTokensToServers,
27 testImage,
28 updateVideo,
29 uploadVideo,
30 userLogin,
31 viewVideo,
32 wait,
33 webtorrentAdd
15} from '../../utils' 34} from '../../utils'
16import { 35import {
17 addVideoCommentReply, addVideoCommentThread, deleteVideoComment, getVideoCommentThreads, 36 addVideoCommentReply,
37 addVideoCommentThread,
38 deleteVideoComment,
39 getVideoCommentThreads,
18 getVideoThreadComments 40 getVideoThreadComments
19} from '../../utils/videos/video-comments' 41} from '../../utils/videos/video-comments'
20 42
@@ -90,8 +112,10 @@ describe('Test multiple servers', function () {
90 nsfw: true, 112 nsfw: true,
91 description: 'my super description for server 1', 113 description: 'my super description for server 1',
92 support: 'my super support text for server 1', 114 support: 'my super support text for server 1',
93 host: 'localhost:9001', 115 account: {
94 account: 'root', 116 name: 'root',
117 host: 'localhost:9001'
118 },
95 isLocal, 119 isLocal,
96 duration: 10, 120 duration: 10,
97 tags: [ 'tag1p1', 'tag2p1' ], 121 tags: [ 'tag1p1', 'tag2p1' ],
@@ -160,8 +184,10 @@ describe('Test multiple servers', function () {
160 nsfw: true, 184 nsfw: true,
161 description: 'my super description for server 2', 185 description: 'my super description for server 2',
162 support: 'my super support text for server 2', 186 support: 'my super support text for server 2',
163 host: 'localhost:9002', 187 account: {
164 account: 'user1', 188 name: 'user1',
189 host: 'localhost:9002'
190 },
165 isLocal, 191 isLocal,
166 commentsEnabled: true, 192 commentsEnabled: true,
167 duration: 5, 193 duration: 5,
@@ -264,8 +290,10 @@ describe('Test multiple servers', function () {
264 nsfw: true, 290 nsfw: true,
265 description: 'my super description for server 3', 291 description: 'my super description for server 3',
266 support: 'my super support text for server 3', 292 support: 'my super support text for server 3',
267 host: 'localhost:9003', 293 account: {
268 account: 'root', 294 name: 'root',
295 host: 'localhost:9003'
296 },
269 isLocal, 297 isLocal,
270 duration: 5, 298 duration: 5,
271 commentsEnabled: true, 299 commentsEnabled: true,
@@ -294,8 +322,10 @@ describe('Test multiple servers', function () {
294 nsfw: false, 322 nsfw: false,
295 description: 'my super description for server 3-2', 323 description: 'my super description for server 3-2',
296 support: 'my super support text for server 3-2', 324 support: 'my super support text for server 3-2',
297 host: 'localhost:9003', 325 account: {
298 account: 'root', 326 name: 'root',
327 host: 'localhost:9003'
328 },
299 commentsEnabled: true, 329 commentsEnabled: true,
300 isLocal, 330 isLocal,
301 duration: 5, 331 duration: 5,
@@ -570,8 +600,10 @@ describe('Test multiple servers', function () {
570 nsfw: true, 600 nsfw: true,
571 description: 'my super description updated', 601 description: 'my super description updated',
572 support: 'my super support text updated', 602 support: 'my super support text updated',
573 host: 'localhost:9003', 603 account: {
574 account: 'root', 604 name: 'root',
605 host: 'localhost:9003'
606 },
575 isLocal, 607 isLocal,
576 duration: 5, 608 duration: 5,
577 commentsEnabled: true, 609 commentsEnabled: true,
@@ -648,7 +680,10 @@ describe('Test multiple servers', function () {
648 expect(baseVideo.licence).to.equal(video.licence) 680 expect(baseVideo.licence).to.equal(video.licence)
649 expect(baseVideo.category).to.equal(video.category) 681 expect(baseVideo.category).to.equal(video.category)
650 expect(baseVideo.nsfw).to.equal(video.nsfw) 682 expect(baseVideo.nsfw).to.equal(video.nsfw)
651 expect(baseVideo.accountName).to.equal(video.accountName) 683 expect(baseVideo.account.name).to.equal(video.account.name)
684 expect(baseVideo.account.displayName).to.equal(video.account.displayName)
685 expect(baseVideo.account.url).to.equal(video.account.url)
686 expect(baseVideo.account.host).to.equal(video.account.host)
652 expect(baseVideo.tags).to.deep.equal(video.tags) 687 expect(baseVideo.tags).to.deep.equal(video.tags)
653 } 688 }
654 }) 689 })
@@ -859,8 +894,10 @@ describe('Test multiple servers', function () {
859 nsfw: false, 894 nsfw: false,
860 description: null, 895 description: null,
861 support: null, 896 support: null,
862 host: 'localhost:9002', 897 account: {
863 account: 'root', 898 name: 'root',
899 host: 'localhost:9002'
900 },
864 isLocal, 901 isLocal,
865 duration: 5, 902 duration: 5,
866 commentsEnabled: true, 903 commentsEnabled: true,
diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts
index e456184cf..45b4a1a81 100644
--- a/server/tests/api/videos/services.ts
+++ b/server/tests/api/videos/services.ts
@@ -38,7 +38,7 @@ describe('Test services', function () {
38 38
39 expect(res.body.html).to.equal(expectedHtml) 39 expect(res.body.html).to.equal(expectedHtml)
40 expect(res.body.title).to.equal(server.video.name) 40 expect(res.body.title).to.equal(server.video.name)
41 expect(res.body.author_name).to.equal(server.video.accountName) 41 expect(res.body.author_name).to.equal(server.video.account.name)
42 expect(res.body.width).to.equal(560) 42 expect(res.body.width).to.equal(560)
43 expect(res.body.height).to.equal(315) 43 expect(res.body.height).to.equal(315)
44 expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl) 44 expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl)
@@ -58,7 +58,7 @@ describe('Test services', function () {
58 58
59 expect(res.body.html).to.equal(expectedHtml) 59 expect(res.body.html).to.equal(expectedHtml)
60 expect(res.body.title).to.equal(server.video.name) 60 expect(res.body.title).to.equal(server.video.name)
61 expect(res.body.author_name).to.equal(server.video.accountName) 61 expect(res.body.author_name).to.equal(server.video.account.name)
62 expect(res.body.height).to.equal(50) 62 expect(res.body.height).to.equal(50)
63 expect(res.body.width).to.equal(50) 63 expect(res.body.width).to.equal(50)
64 expect(res.body).to.not.have.property('thumbnail_url') 64 expect(res.body).to.not.have.property('thumbnail_url')
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index cf2721838..7c4bdf8bc 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -27,8 +27,10 @@ describe('Test a single server', function () {
27 nsfw: true, 27 nsfw: true,
28 description: 'my super description', 28 description: 'my super description',
29 support: 'my super support text', 29 support: 'my super support text',
30 host: 'localhost:9001', 30 account: {
31 account: 'root', 31 name: 'root',
32 host: 'localhost:9001'
33 },
32 isLocal: true, 34 isLocal: true,
33 duration: 5, 35 duration: 5,
34 tags: [ 'tag1', 'tag2', 'tag3' ], 36 tags: [ 'tag1', 'tag2', 'tag3' ],
@@ -56,8 +58,10 @@ describe('Test a single server', function () {
56 nsfw: false, 58 nsfw: false,
57 description: 'my super description updated', 59 description: 'my super description updated',
58 support: 'my super support text updated', 60 support: 'my super support text updated',
59 host: 'localhost:9001', 61 account: {
60 account: 'root', 62 name: 'root',
63 host: 'localhost:9001'
64 },
61 isLocal: true, 65 isLocal: true,
62 tags: [ 'tagup1', 'tagup2' ], 66 tags: [ 'tagup1', 'tagup2' ],
63 privacy: VideoPrivacy.PUBLIC, 67 privacy: VideoPrivacy.PUBLIC,
@@ -205,32 +209,6 @@ describe('Test a single server', function () {
205 }) 209 })
206 210
207 // Not implemented yet 211 // Not implemented yet
208 // it('Should search the video by serverHost', async function () {
209 // const res = await videosUtils.searchVideo(server.url, '9001', 'host')
210
211 // expect(res.body.total).to.equal(1)
212 // expect(res.body.data).to.be.an('array')
213 // expect(res.body.data.length).to.equal(1)
214
215 // const video = res.body.data[0]
216 // expect(video.name).to.equal('my super name')
217 // expect(video.description).to.equal('my super description')
218 // expect(video.serverHost).to.equal('localhost:9001')
219 // expect(video.author).to.equal('root')
220 // expect(video.isLocal).to.be.true
221 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
222 // expect(dateIsValid(video.createdAt)).to.be.true
223 // expect(dateIsValid(video.updatedAt)).to.be.true
224
225 // const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
226 // expect(test).to.equal(true)
227
228 // done()
229 // })
230 // })
231 // })
232
233 // Not implemented yet
234 // it('Should search the video by tag', async function () { 212 // it('Should search the video by tag', async function () {
235 // const res = await searchVideo(server.url, 'tag1') 213 // const res = await searchVideo(server.url, 'tag1')
236 // 214 //
@@ -248,8 +226,8 @@ describe('Test a single server', function () {
248 // expect(video.languageLabel).to.equal('Mandarin') 226 // expect(video.languageLabel).to.equal('Mandarin')
249 // expect(video.nsfw).to.be.ok 227 // expect(video.nsfw).to.be.ok
250 // expect(video.description).to.equal('my super description') 228 // expect(video.description).to.equal('my super description')
251 // expect(video.serverHost).to.equal('localhost:9001') 229 // expect(video.account.name).to.equal('root')
252 // expect(video.accountName).to.equal('root') 230 // expect(video.account.host).to.equal('localhost:9001')
253 // expect(video.isLocal).to.be.true 231 // expect(video.isLocal).to.be.true
254 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 232 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
255 // expect(dateIsValid(video.createdAt)).to.be.true 233 // expect(dateIsValid(video.createdAt)).to.be.true