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.ts14
-rw-r--r--server/tests/api/videos/single-server.ts17
-rw-r--r--server/tests/api/videos/video-comments.ts4
3 files changed, 19 insertions, 16 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 6712829d4..4c4b5123d 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -8,8 +8,9 @@ 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, completeVideoCheck, createUser, dateIsValid, doubleFollow, flushAndRunMultipleServers, flushTests, getVideo, 11 addVideoChannel, checkVideoFilesWereRemoved, completeVideoCheck, createUser, dateIsValid, doubleFollow, flushAndRunMultipleServers,
12 getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testVideoImage, 12 flushTests, getVideo,
13 getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testImage,
13 updateVideo, uploadVideo, userLogin, viewVideo, wait, webtorrentAdd 14 updateVideo, uploadVideo, userLogin, viewVideo, wait, webtorrentAdd
14} from '../../utils' 15} from '../../utils'
15import { 16import {
@@ -578,6 +579,13 @@ describe('Test multiple servers', function () {
578 await wait(5000) 579 await wait(5000)
579 }) 580 })
580 581
582 it('Should not have files of videos 3 and 3-2 on each server', async function () {
583 for (const server of servers) {
584 await checkVideoFilesWereRemoved(toRemove[0].uuid, server.serverNumber)
585 await checkVideoFilesWereRemoved(toRemove[1].uuid, server.serverNumber)
586 }
587 })
588
581 it('Should have videos 1 and 3 on each server', async function () { 589 it('Should have videos 1 and 3 on each server', async function () {
582 for (const server of servers) { 590 for (const server of servers) {
583 const res = await getVideosList(server.url) 591 const res = await getVideosList(server.url)
@@ -624,7 +632,7 @@ describe('Test multiple servers', function () {
624 const res = await getVideo(server.url, videoUUID) 632 const res = await getVideo(server.url, videoUUID)
625 const video = res.body 633 const video = res.body
626 634
627 const test = await testVideoImage(server.url, 'video_short1-preview.webm', video.previewPath) 635 const test = await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
628 expect(test).to.equal(true) 636 expect(test).to.equal(true)
629 } 637 }
630 }) 638 })
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index ca20f39a0..76d265ec5 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -3,13 +3,12 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import { keyBy } from 'lodash' 4import { keyBy } from 'lodash'
5import 'mocha' 5import 'mocha'
6import { join } from 'path'
7import { VideoPrivacy } from '../../../../shared/models/videos' 6import { VideoPrivacy } from '../../../../shared/models/videos'
8import { readdirPromise } from '../../../helpers/core-utils'
9import { 7import {
10 completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences, getVideoPrivacies, 8 checkVideoFilesWereRemoved, completeVideoCheck, flushTests, getVideo, getVideoCategories, getVideoLanguages, getVideoLicences,
11 getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, removeVideo, runServer, searchVideo, 9 getVideoPrivacies, getVideosList, getVideosListPagination, getVideosListSort, killallServers, rateVideo, removeVideo, runServer,
12 searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testVideoImage, updateVideo, uploadVideo, viewVideo 10 searchVideo, searchVideoWithPagination, searchVideoWithSort, ServerInfo, setAccessTokensToServers, testImage, updateVideo, uploadVideo,
11 viewVideo
13} from '../../utils' 12} from '../../utils'
14 13
15const expect = chai.expect 14const expect = chai.expect
@@ -277,11 +276,7 @@ describe('Test a single server', function () {
277 it('Should remove the video', async function () { 276 it('Should remove the video', async function () {
278 await removeVideo(server.url, server.accessToken, videoId) 277 await removeVideo(server.url, server.accessToken, videoId)
279 278
280 const files1 = await readdirPromise(join(__dirname, '..', '..', '..', '..', 'test1', 'videos')) 279 await checkVideoFilesWereRemoved(videoUUID, 1)
281 expect(files1).to.have.lengthOf(0)
282
283 const files2 = await readdirPromise(join(__dirname, '..', '..', '..', '..', 'test1', 'thumbnails'))
284 expect(files2).to.have.lengthOf(0)
285 }) 280 })
286 281
287 it('Should not have videos', async function () { 282 it('Should not have videos', async function () {
@@ -346,7 +341,7 @@ describe('Test a single server', function () {
346 341
347 for (const video of videos) { 342 for (const video of videos) {
348 const videoName = video.name.replace(' name', '') 343 const videoName = video.name.replace(' name', '')
349 const test = await testVideoImage(server.url, videoName, video.thumbnailPath) 344 const test = await testImage(server.url, videoName, video.thumbnailPath)
350 345
351 expect(test).to.equal(true) 346 expect(test).to.equal(true)
352 } 347 }
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index 18d484ccf..0eddac35b 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -3,7 +3,7 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 5import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
6import { testVideoImage } from '../../utils' 6import { testImage } from '../../utils'
7import { 7import {
8 dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, updateMyAvatar, 8 dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, updateMyAvatar,
9 uploadVideo 9 uploadVideo
@@ -83,7 +83,7 @@ describe('Test video comments', function () {
83 expect(comment.account.name).to.equal('root') 83 expect(comment.account.name).to.equal('root')
84 expect(comment.account.host).to.equal('localhost:9001') 84 expect(comment.account.host).to.equal('localhost:9001')
85 85
86 const test = await testVideoImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') 86 const test = await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png')
87 expect(test).to.equal(true) 87 expect(test).to.equal(true)
88 88
89 expect(comment.totalReplies).to.equal(0) 89 expect(comment.totalReplies).to.equal(0)