import 'mocha'
import * as chai from 'chai'
-import { advancedVideoChannelSearch } from '@shared/extra-utils/search/video-channels'
-import { ServerConfig } from '@shared/models'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
+import { HttpStatusCode } from '@shared/core-utils'
import {
addVideoCommentReply,
addVideoCommentThread,
- advancedVideosSearch,
- createLive,
+ cleanupTests,
createVideoPlaylist,
doubleFollow,
+ flushAndRunMultipleServers,
getAccountVideos,
- getConfig,
getMyVideos,
- getPluginTestPath,
getVideo,
getVideoChannelVideos,
getVideoCommentThreads,
getVideosListPagination,
getVideoThreadComments,
getVideoWithToken,
- installPlugin,
makeRawRequest,
+ PluginsCommand,
registerUser,
+ ServerInfo,
setAccessTokensToServers,
setDefaultVideoChannel,
- updateCustomSubConfig,
updateVideo,
uploadVideo,
uploadVideoAndGetId,
- waitJobs
-} from '../../../shared/extra-utils'
-import { cleanupTests, flushAndRunMultipleServers, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers'
-import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports'
+ waitJobs,
+ waitUntilLog
+} from '@shared/extra-utils'
+import { getGoodVideoUrl, getMyVideoImports, importVideo } from '@shared/extra-utils/videos/video-imports'
import {
VideoCommentThreadTree,
VideoDetails,
VideoPlaylist,
VideoPlaylistPrivacy,
VideoPrivacy
-} from '../../../shared/models/videos'
+} from '@shared/models'
const expect = chai.expect
await setDefaultVideoChannel(servers)
await doubleFollow(servers[0], servers[1])
- await installPlugin({
- url: servers[0].url,
- accessToken: servers[0].accessToken,
- path: getPluginTestPath()
- })
-
- await installPlugin({
- url: servers[0].url,
- accessToken: servers[0].accessToken,
- path: getPluginTestPath('-two')
- })
+ await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath() })
+ await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') })
for (let i = 0; i < 10; i++) {
await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'default video ' + i })
const res = await getVideosList(servers[0].url)
videoUUID = res.body.data[0].uuid
- await updateCustomSubConfig(servers[0].url, servers[0].accessToken, {
- live: { enabled: true },
- signup: { enabled: true },
- import: {
- videos: {
- http: { enabled: true },
- torrent: { enabled: true }
+ await servers[0].configCommand.updateCustomSubConfig({
+ newConfig: {
+ live: { enabled: true },
+ signup: { enabled: true },
+ import: {
+ videos: {
+ http: { enabled: true },
+ torrent: { enabled: true }
+ }
}
}
})
channelId: servers[0].videoChannel.id
}
- await createLive(servers[0].url, servers[0].accessToken, attributes, HttpStatusCode.FORBIDDEN_403)
+ await servers[0].liveCommand.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
})
it('Should run filter:api.video.pre-import-url.accept.result', async function () {
})
it('Should blacklist on remote upload', async function () {
- this.timeout(60000)
+ this.timeout(120000)
const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'remote please blacklist me' })
await waitJobs(servers)
})
it('Should blacklist on remote update', async function () {
- this.timeout(60000)
+ this.timeout(120000)
const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video' })
await waitJobs(servers)
describe('Should run filter:api.user.signup.allowed.result', function () {
it('Should run on config endpoint', async function () {
- const res = await getConfig(servers[0].url)
- expect((res.body as ServerConfig).signup.allowed).to.be.true
+ const body = await servers[0].configCommand.getConfig()
+ expect(body.signup.allowed).to.be.true
})
it('Should allow a signup', async function () {
const downloadVideos: VideoDetails[] = []
before(async function () {
- this.timeout(60000)
-
- await updateCustomSubConfig(servers[0].url, servers[0].accessToken, {
- transcoding: {
- webtorrent: {
- enabled: true
- },
- hls: {
- enabled: true
+ this.timeout(120000)
+
+ await servers[0].configCommand.updateCustomSubConfig({
+ newConfig: {
+ transcoding: {
+ webtorrent: {
+ enabled: true
+ },
+ hls: {
+ enabled: true
+ }
}
}
})
before(async function () {
this.timeout(60000)
- await updateCustomSubConfig(servers[0].url, servers[0].accessToken, {
- transcoding: {
- enabled: false
+ await servers[0].configCommand.updateCustomSubConfig({
+ newConfig: {
+ transcoding: {
+ enabled: false
+ }
}
})
describe('Search filters', function () {
before(async function () {
- await updateCustomSubConfig(servers[0].url, servers[0].accessToken, {
- search: {
- searchIndex: {
- enabled: true,
- isDefaultSearch: false,
- disableLocalSearch: false
+ await servers[0].configCommand.updateCustomSubConfig({
+ newConfig: {
+ search: {
+ searchIndex: {
+ enabled: true,
+ isDefaultSearch: false,
+ disableLocalSearch: false
+ }
}
}
})
})
it('Should run filter:api.search.videos.local.list.{params,result}', async function () {
- await advancedVideosSearch(servers[0].url, {
- search: 'Sun Quan'
+ await servers[0].searchCommand.advancedVideoSearch({
+ search: {
+ search: 'Sun Quan'
+ }
})
await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1)
})
it('Should run filter:api.search.videos.index.list.{params,result}', async function () {
- await advancedVideosSearch(servers[0].url, {
- search: 'Sun Quan',
- searchTarget: 'search-index'
+ await servers[0].searchCommand.advancedVideoSearch({
+ search: {
+ search: 'Sun Quan',
+ searchTarget: 'search-index'
+ }
})
await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1)
})
it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () {
- await advancedVideoChannelSearch(servers[0].url, {
- search: 'Sun Ce'
+ await servers[0].searchCommand.advancedChannelSearch({
+ search: {
+ search: 'Sun Ce'
+ }
})
await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1)
})
it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () {
- await advancedVideoChannelSearch(servers[0].url, {
- search: 'Sun Ce',
- searchTarget: 'search-index'
+ await servers[0].searchCommand.advancedChannelSearch({
+ search: {
+ search: 'Sun Ce',
+ searchTarget: 'search-index'
+ }
})
await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1)
await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.params', 1)
await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.result', 1)
})
+
+ it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () {
+ await servers[0].searchCommand.advancedPlaylistSearch({
+ search: {
+ search: 'Sun Jian'
+ }
+ })
+
+ await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1)
+ await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.result', 1)
+ })
+
+ it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () {
+ await servers[0].searchCommand.advancedPlaylistSearch({
+ search: {
+ search: 'Sun Jian',
+ searchTarget: 'search-index'
+ }
+ })
+
+ await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1)
+ await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.result', 1)
+ await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.index.list.params', 1)
+ await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.index.list.result', 1)
+ })
})
after(async function () {