X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-nsfw.ts;h=34713025df3c25530da264a71125947d1593046b;hb=ba2684ceddf9b76312635b9cddc6bf6975ce436a;hp=b25dcda204b1578f5f589399adcf1b10f8dd9009;hpb=254d3579f5338f5fd775c17d15cdfc37078bcfb4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index b25dcda20..34713025d 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, createSingleServer, PeerTubeServer, 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 @@ -19,8 +19,10 @@ describe('Test video NSFW policy', function () { 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 @@ -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') @@ -133,7 +136,7 @@ describe('Test video NSFW policy', function () { it('Should create a user having the default nsfw policy', async function () { const username = 'user1' const password = 'my super password' - await server.users.create({ username: username, password: password }) + await server.users.create({ username, password }) userAccessToken = await server.login.getAccessToken({ username, password })