From 7c3b79768bd174b22154e8d2df0b1211e01ee56a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Apr 2019 15:10:37 +0200 Subject: Use test wrapper exit function --- server/tests/api/videos/multiple-servers.ts | 6 +++--- server/tests/api/videos/services.ts | 16 ++++------------ server/tests/api/videos/single-server.ts | 9 ++++----- server/tests/api/videos/video-abuse.ts | 5 +++-- server/tests/api/videos/video-blacklist.ts | 6 +++--- server/tests/api/videos/video-captions.ts | 6 +++--- server/tests/api/videos/video-change-ownership.ts | 6 +++--- server/tests/api/videos/video-channels.ts | 5 +++-- server/tests/api/videos/video-comments.ts | 8 +++----- server/tests/api/videos/video-description.ts | 5 +++-- server/tests/api/videos/video-hls.ts | 6 +++--- server/tests/api/videos/video-imports.ts | 5 +++-- server/tests/api/videos/video-nsfw.ts | 15 ++++----------- server/tests/api/videos/video-playlists.ts | 6 +++--- server/tests/api/videos/video-privacy.ts | 5 +++-- server/tests/api/videos/video-schedule-update.ts | 5 +++-- server/tests/api/videos/video-transcoder.ts | 6 +++--- server/tests/api/videos/videos-filter.ts | 5 +++-- server/tests/api/videos/videos-history.ts | 11 ++++++----- server/tests/api/videos/videos-overview.ts | 6 +++--- server/tests/api/videos/videos-views-cleaner.ts | 6 +++--- 21 files changed, 69 insertions(+), 79 deletions(-) (limited to 'server/tests/api/videos') diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 50b231555..68c1e9a8d 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -9,7 +9,7 @@ import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/ import { addVideoChannel, checkTmpIsEmpty, - checkVideoFilesWereRemoved, + checkVideoFilesWereRemoved, cleanupTests, completeVideoCheck, createUser, dateIsValid, @@ -1029,7 +1029,7 @@ describe('Test multiple servers', function () { }) }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts index 1397347d1..e9ad947b2 100644 --- a/server/tests/api/videos/services.ts +++ b/server/tests/api/videos/services.ts @@ -2,16 +2,8 @@ import * as chai from 'chai' import 'mocha' -import { - flushTests, - getOEmbed, - getVideosList, - killallServers, - ServerInfo, - setAccessTokensToServers, - uploadVideo -} from '../../../../shared/extra-utils/index' -import { flushAndRunServer } from '../../../../shared/extra-utils/server/servers' +import { getOEmbed, getVideosList, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils/index' +import { cleanupTests, flushAndRunServer } from '../../../../shared/extra-utils/server/servers' const expect = chai.expect @@ -74,7 +66,7 @@ describe('Test services', function () { expect(res.body).to.not.have.property('thumbnail_height') }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) }) diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index db2a3779f..1f366b642 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -6,8 +6,9 @@ import 'mocha' import { VideoPrivacy } from '../../../../shared/models/videos' import { checkVideoFilesWereRemoved, + cleanupTests, completeVideoCheck, - flushTests, + flushAndRunServer, getVideo, getVideoCategories, getVideoLanguages, @@ -17,10 +18,8 @@ import { getVideosListPagination, getVideosListSort, getVideosWithFilters, - killallServers, rateVideo, removeVideo, - flushAndRunServer, ServerInfo, setAccessTokensToServers, testImage, @@ -424,7 +423,7 @@ describe('Test a single server', function () { expect(video.dislikes).to.equal(1) }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) }) diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts index 06bb31348..7318497d5 100644 --- a/server/tests/api/videos/video-abuse.ts +++ b/server/tests/api/videos/video-abuse.ts @@ -4,6 +4,7 @@ import * as chai from 'chai' import 'mocha' import { VideoAbuse, VideoAbuseState } from '../../../../shared/models/videos' import { + cleanupTests, deleteVideoAbuse, flushAndRunMultipleServers, getVideoAbusesList, @@ -172,7 +173,7 @@ describe('Test video abuses', function () { expect(res.body.data.length).to.equal(0) }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts index cb15d1a52..e907bbdc0 100644 --- a/server/tests/api/videos/video-blacklist.ts +++ b/server/tests/api/videos/video-blacklist.ts @@ -4,7 +4,7 @@ import * as chai from 'chai' import { orderBy } from 'lodash' import 'mocha' import { - addVideoToBlacklist, + addVideoToBlacklist, cleanupTests, createUser, flushAndRunMultipleServers, getBlacklistedVideosList, @@ -425,7 +425,7 @@ describe('Test video blacklist', function () { }) }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts index c6f59762a..5e13f5949 100644 --- a/server/tests/api/videos/video-captions.ts +++ b/server/tests/api/videos/video-captions.ts @@ -3,7 +3,7 @@ import * as chai from 'chai' import 'mocha' import { - checkVideoFilesWereRemoved, + checkVideoFilesWereRemoved, cleanupTests, doubleFollow, flushAndRunMultipleServers, removeVideo, @@ -195,7 +195,7 @@ describe('Test video captions', function () { await checkVideoFilesWereRemoved(videoUUID, 1) }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index db1220677..1c0327d40 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts @@ -4,7 +4,7 @@ import * as chai from 'chai' import 'mocha' import { acceptChangeOwnership, - changeVideoOwnership, + changeVideoOwnership, cleanupTests, createUser, doubleFollow, flushAndRunMultipleServers, @@ -297,7 +297,7 @@ describe('Test video change ownership - quota too small', function () { await acceptChangeOwnership(server.url, secondUserAccessToken, lastRequestChangeOwnershipId, channelId, 403) }) - after(function () { - killallServers([server]) + after(async function () { + await cleanupTests([ server ]) }) }) diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 60b84e443..345e96f43 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts @@ -4,6 +4,7 @@ import * as chai from 'chai' import 'mocha' import { User, Video } from '../../../../shared/index' import { + cleanupTests, createUser, doubleFollow, flushAndRunMultipleServers, @@ -277,7 +278,7 @@ describe('Test video channels', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 50224ee47..22fd8c058 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts @@ -3,11 +3,9 @@ import * as chai from 'chai' import 'mocha' import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' -import { testImage } from '../../../../shared/extra-utils' +import { cleanupTests, testImage } from '../../../../shared/extra-utils' import { dateIsValid, - flushTests, - killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, @@ -199,7 +197,7 @@ describe('Test video comments', function () { expect(res.body.data[1].totalReplies).to.equal(0) }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) }) diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts index 333d539f4..db4d278bf 100644 --- a/server/tests/api/videos/video-description.ts +++ b/server/tests/api/videos/video-description.ts @@ -3,6 +3,7 @@ import * as chai from 'chai' import 'mocha' import { + cleanupTests, flushAndRunMultipleServers, getVideo, getVideoDescription, @@ -99,7 +100,7 @@ describe('Test video description', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts index 0ac84a656..22031c18b 100644 --- a/server/tests/api/videos/video-hls.ts +++ b/server/tests/api/videos/video-hls.ts @@ -5,7 +5,7 @@ import 'mocha' import { checkDirectoryIsEmpty, checkSegmentHash, - checkTmpIsEmpty, + checkTmpIsEmpty, cleanupTests, doubleFollow, flushAndRunMultipleServers, flushTests, @@ -128,7 +128,7 @@ describe('Test HLS videos', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 49a28e207..1233ed6eb 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts @@ -4,6 +4,7 @@ import * as chai from 'chai' import 'mocha' import { VideoDetails, VideoImport, VideoPrivacy } from '../../../../shared/models/videos' import { + cleanupTests, doubleFollow, flushAndRunMultipleServers, getMyUserInformation, @@ -241,7 +242,7 @@ describe('Test video imports', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index 811705212..ad6a4b43f 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts @@ -2,25 +2,18 @@ import * as chai from 'chai' import 'mocha' -import { - flushTests, - getVideosList, - killallServers, - ServerInfo, - setAccessTokensToServers, - uploadVideo -} from '../../../../shared/extra-utils/index' +import { cleanupTests, getVideosList, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils/index' import { userLogin } from '../../../../shared/extra-utils/users/login' import { createUser } from '../../../../shared/extra-utils/users/users' import { getMyVideos } from '../../../../shared/extra-utils/videos/videos' import { + flushAndRunServer, getAccountVideos, getConfig, getCustomConfig, getMyUserInformation, getVideoChannelVideos, getVideosListWithToken, - flushAndRunServer, searchVideo, searchVideoWithToken, updateCustomConfig, @@ -241,7 +234,7 @@ describe('Test video NSFW policy', function () { }) }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) }) diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index ea349f09b..928568299 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts @@ -5,7 +5,7 @@ import 'mocha' import { addVideoChannel, addVideoInPlaylist, - checkPlaylistFilesWereRemoved, + checkPlaylistFilesWereRemoved, cleanupTests, createUser, createVideoPlaylist, deleteVideoChannel, @@ -860,7 +860,7 @@ describe('Test video playlists', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index a823993b2..ef1cf0f07 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts @@ -4,6 +4,7 @@ import * as chai from 'chai' import 'mocha' import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' import { + cleanupTests, flushAndRunMultipleServers, getVideosList, killallServers, @@ -152,7 +153,7 @@ describe('Test video privacy', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts index d7301a137..64f657780 100644 --- a/server/tests/api/videos/video-schedule-update.ts +++ b/server/tests/api/videos/video-schedule-update.ts @@ -4,6 +4,7 @@ import * as chai from 'chai' import 'mocha' import { VideoPrivacy } from '../../../../shared/models/videos' import { + cleanupTests, doubleFollow, flushAndRunMultipleServers, getMyVideos, @@ -165,7 +166,7 @@ describe('Test video update scheduler', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index 92888f137..3cd43e99b 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts @@ -6,7 +6,7 @@ import { omit } from 'lodash' import { getMaxBitrate, VideoDetails, VideoResolution, VideoState } from '../../../../shared/models/videos' import { audio, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' import { - buildAbsoluteFixturePath, + buildAbsoluteFixturePath, cleanupTests, doubleFollow, flushAndRunMultipleServers, generateHighBitrateVideo, @@ -349,7 +349,7 @@ describe('Test video transcoding', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts index 179610595..e1e65260f 100644 --- a/server/tests/api/videos/videos-filter.ts +++ b/server/tests/api/videos/videos-filter.ts @@ -3,6 +3,7 @@ import * as chai from 'chai' import 'mocha' import { + cleanupTests, createUser, doubleFollow, flushAndRunMultipleServers, @@ -119,7 +120,7 @@ describe('Test videos filter validator', function () { }) }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts index 2a904c659..c7e55c1ab 100644 --- a/server/tests/api/videos/videos-history.ts +++ b/server/tests/api/videos/videos-history.ts @@ -3,12 +3,13 @@ import * as chai from 'chai' import 'mocha' import { + cleanupTests, createUser, - flushTests, + flushAndRunServer, getVideosListWithToken, getVideoWithToken, - killallServers, reRunServer, - flushAndRunServer, + killallServers, + reRunServer, searchVideoWithToken, ServerInfo, setAccessTokensToServers, @@ -220,7 +221,7 @@ describe('Test videos history', function () { expect(res.body.total).to.equal(0) }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) }) diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts index c63725d71..975a5c87a 100644 --- a/server/tests/api/videos/videos-overview.ts +++ b/server/tests/api/videos/videos-overview.ts @@ -2,7 +2,7 @@ import * as chai from 'chai' import 'mocha' -import { flushAndRunServer, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils' +import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils' import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews' import { VideosOverview } from '../../../../shared/models/overviews' @@ -87,7 +87,7 @@ describe('Test a videos overview', function () { expect(overview.channels[0].channel.name).to.equal('root_channel') }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) }) diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts index 80cecdd23..c21d46d56 100644 --- a/server/tests/api/videos/videos-views-cleaner.ts +++ b/server/tests/api/videos/videos-views-cleaner.ts @@ -10,7 +10,7 @@ import { flushAndRunServer, ServerInfo, setAccessTokensToServers, - uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs + uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs, cleanupTests } from '../../../../shared/extra-utils' import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews' import { VideosOverview } from '../../../../shared/models/overviews' @@ -100,7 +100,7 @@ describe('Test video views cleaner', function () { } }) - after(function () { - killallServers(servers) + after(async function () { + await cleanupTests(servers) }) }) -- cgit v1.2.3