X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-nsfw.ts;h=99ea67a0fe1644d61ec31f6c2889adc84779f58e;hb=bf54587a3e2ad9c2c186828f2a5682b91ee2cc00;hp=95395a582e43bafcb2ec8498e9eee4191ef20eae;hpb=89d241a79c262b9775c233b73cff080043ebb5e6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index 95395a582..99ea67a0f 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts @@ -2,7 +2,7 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' const expect = chai.expect @@ -13,14 +13,16 @@ function createOverviewRes (overview: VideosOverview) { } describe('Test video NSFW policy', function () { - let server: ServerInfo + let server: PeerTubeServer let userAccessToken: string let customConfig: CustomConfig async function getVideosFunctions (token?: string, query: { nsfw?: BooleanBothQuery } = {}) { const user = await server.users.getMyInfo() - const videoChannelName = user.videoChannels[0].name + + const channelName = user.videoChannels[0].name const accountName = user.account.name + '@' + user.account.host + const hasQuery = Object.keys(query).length !== 0 let promises: Promise>[] @@ -28,8 +30,8 @@ describe('Test video NSFW policy', function () { promises = [ server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), server.videos.listWithToken({ token, ...query }), - server.videos.listByAccount({ token, accountName, ...query }), - server.videos.listByChannel({ token, videoChannelName, ...query }) + server.videos.listByAccount({ token, handle: accountName, ...query }), + server.videos.listByChannel({ token, handle: channelName, ...query }) ] // Overviews do not support video filters @@ -45,8 +47,8 @@ describe('Test video NSFW policy', function () { promises = [ server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), server.videos.list(), - server.videos.listByAccount({ accountName }), - server.videos.listByChannel({ videoChannelName }) + server.videos.listByAccount({ token: null, handle: accountName }), + server.videos.listByChannel({ token: null, handle: channelName }) ] // Overviews do not support video filters @@ -61,7 +63,7 @@ describe('Test video NSFW policy', function () { before(async function () { this.timeout(50000) - server = await flushAndRunServer(1) + server = await createSingleServer(1) // Get the access tokens await setAccessTokensToServers([ server ]) @@ -80,6 +82,7 @@ describe('Test video NSFW policy', function () { }) describe('Instance default NSFW policy', function () { + it('Should display NSFW videos with display default NSFW policy', async function () { const serverConfig = await server.config.getConfig() expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')