wait,
waitJobs
} from '@shared/extra-utils'
import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models'
describe('Test moderation notifications', function () {
wait,
waitJobs
} from '@shared/extra-utils'
import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models'
describe('Test moderation notifications', function () {
let userAccessToken: string
let userNotifications: UserNotification[] = []
let adminNotifications: UserNotification[] = []
let userAccessToken: string
let userNotifications: UserNotification[] = []
let adminNotifications: UserNotification[] = []
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const video = resVideo.body.video
+ const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
await waitJobs(servers)
await checkNewVideoAbuseForModerators(baseParams, video.uuid, name, 'presence')
await waitJobs(servers)
await checkNewVideoAbuseForModerators(baseParams, video.uuid, name, 'presence')
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const video = resVideo.body.video
+ const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
- const videoId = await getVideoIdFromUUID(servers[1].url, video.uuid)
- await servers[1].abusesCommand.report({ videoId, reason: 'super reason' })
+ const videoId = await servers[1].videos.getId({ uuid: video.uuid })
+ await servers[1].abuses.report({ videoId, reason: 'super reason' })
await waitJobs(servers)
await checkNewVideoAbuseForModerators(baseParams, video.uuid, name, 'presence')
await waitJobs(servers)
await checkNewVideoAbuseForModerators(baseParams, video.uuid, name, 'presence')
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const video = resVideo.body.video
- const comment = await servers[0].commentsCommand.createThread({
+ const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
+ const comment = await servers[0].comments.createThread({
await waitJobs(servers)
await checkNewCommentAbuseForModerators(baseParams, video.uuid, name, 'presence')
await waitJobs(servers)
await checkNewCommentAbuseForModerators(baseParams, video.uuid, name, 'presence')
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const video = resVideo.body.video
+ const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
await waitJobs(servers)
await checkNewCommentAbuseForModerators(baseParams, video.uuid, name, 'presence')
await waitJobs(servers)
await checkNewCommentAbuseForModerators(baseParams, video.uuid, name, 'presence')
- const resUser = await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username, password: 'donald' })
- const accountId = resUser.body.user.account.id
+ const { account } = await servers[0].users.create({ username, password: 'donald' })
+ const accountId = account.id
- const tmpToken = await generateUserAccessToken(servers[0], username)
- await uploadVideo(servers[0].url, tmpToken, { name: 'super video' })
+ const tmpToken = await servers[0].users.generateUserAndToken(username)
+ await servers[0].videos.upload({ token: tmpToken, attributes: { name: 'super video' } })
- const account = await servers[1].accountsCommand.get({ accountName: username + '@' + servers[0].host })
- await servers[1].abusesCommand.report({ accountId: account.id, reason: 'super reason' })
+ const account = await servers[1].accounts.get({ accountName: username + '@' + servers[0].host })
+ await servers[1].abuses.report({ accountId: account.id, reason: 'super reason' })
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const video = resVideo.body.video
+ const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
- const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
+ const body = await servers[0].abuses.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
await waitJobs(servers)
await checkAbuseStateChange(baseParams, abuseId, AbuseState.ACCEPTED, 'presence')
await waitJobs(servers)
await checkAbuseStateChange(baseParams, abuseId, AbuseState.ACCEPTED, 'presence')
await waitJobs(servers)
await checkAbuseStateChange(baseParams, abuseId, AbuseState.REJECTED, 'presence')
await waitJobs(servers)
await checkAbuseStateChange(baseParams, abuseId, AbuseState.REJECTED, 'presence')
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const video = resVideo.body.video
+ const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
- const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
+ const body = await servers[0].abuses.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
- const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason 2' })
+ const body = await servers[0].abuses.report({ token: userAccessToken, videoId: video.id, reason: 'super reason 2' })
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsUser, abuseId, message, 'user_1@example.com', 'presence')
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsUser, abuseId, message, 'user_1@example.com', 'presence')
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsAdmin, abuseId, message, 'admin' + servers[0].internalServerNumber + '@example.com', 'absence')
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsAdmin, abuseId, message, 'admin' + servers[0].internalServerNumber + '@example.com', 'absence')
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsAdmin, abuseId2, message, 'admin' + servers[0].internalServerNumber + '@example.com', 'presence')
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsAdmin, abuseId2, message, 'admin' + servers[0].internalServerNumber + '@example.com', 'presence')
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsUser, abuseId2, message, 'user_1@example.com', 'absence')
await waitJobs(servers)
await checkNewAbuseMessage(baseParamsUser, abuseId2, message, 'user_1@example.com', 'absence')
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const uuid = resVideo.body.video.uuid
+ const { uuid } = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
await waitJobs(servers)
await checkNewBlacklistOnMyVideo(baseParams, uuid, name, 'blacklist')
await waitJobs(servers)
await checkNewBlacklistOnMyVideo(baseParams, uuid, name, 'blacklist')
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
- const uuid = resVideo.body.video.uuid
+ const { uuid } = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } })
await checkAutoInstanceFollowing({ ...baseParams, ...userOverride }, followerHost, followingHost, 'absence')
config.followings.instance.autoFollowBack.enabled = false
await checkAutoInstanceFollowing({ ...baseParams, ...userOverride }, followerHost, followingHost, 'absence')
config.followings.instance.autoFollowBack.enabled = false
- await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
- await servers[0].followsCommand.unfollow({ target: servers[2] })
- await servers[2].followsCommand.unfollow({ target: servers[0] })
+ await servers[0].config.updateCustomSubConfig({ newConfig: config })
+ await servers[0].follows.unfollow({ target: servers[2] })
+ await servers[2].follows.unfollow({ target: servers[0] })
await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
config.followings.instance.autoFollowIndex.enabled = false
await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
config.followings.instance.autoFollowIndex.enabled = false
- await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
- await servers[0].followsCommand.unfollow({ target: servers[1] })
+ await servers[0].config.updateCustomSubConfig({ newConfig: config })
+ await servers[0].follows.unfollow({ target: servers[1] })
// enable transcoding otherwise own publish notification after transcoding not expected
autoBlacklistTestsCustomConfig.transcoding.enabled = true
// enable transcoding otherwise own publish notification after transcoding not expected
autoBlacklistTestsCustomConfig.transcoding.enabled = true
- await servers[0].subscriptionsCommand.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
- await servers[1].subscriptionsCommand.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
+ await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
+ await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName })
- videoUUID = resVideo.body.video.uuid
+ const { uuid } = await servers[0].videos.upload({ token: userAccessToken, attributes: { name: videoName } })
+ videoUUID = uuid
await waitJobs(servers)
await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, videoUUID, videoName, 'presence')
await waitJobs(servers)
await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, videoUUID, videoName, 'presence')
name,
privacy: VideoPrivacy.PRIVATE,
scheduleUpdate: {
updateAt: updateAt.toISOString(),
name,
privacy: VideoPrivacy.PRIVATE,
scheduleUpdate: {
updateAt: updateAt.toISOString(),
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, data)
- const uuid = resVideo.body.video.uuid
+ const { uuid } = await servers[0].videos.upload({ token: userAccessToken, attributes })
await waitJobs(servers)
await checkNewBlacklistOnMyVideo(userBaseParams, uuid, name, 'unblacklist')
await waitJobs(servers)
await checkNewBlacklistOnMyVideo(userBaseParams, uuid, name, 'unblacklist')
name,
privacy: VideoPrivacy.PRIVATE,
scheduleUpdate: {
updateAt: updateAt.toISOString(),
name,
privacy: VideoPrivacy.PRIVATE,
scheduleUpdate: {
updateAt: updateAt.toISOString(),
- const resVideo = await uploadVideo(servers[0].url, userAccessToken, data)
- const uuid = resVideo.body.video.uuid
+ const { uuid } = await servers[0].videos.upload({ token: userAccessToken, attributes })
await wait(6000)
await checkVideoIsPublished(userBaseParams, name, uuid, 'absence')
await wait(6000)
await checkVideoIsPublished(userBaseParams, name, uuid, 'absence')
const name = 'video without auto-blacklist ' + buildUUID()
// admin with blacklist right will not be auto-blacklisted
const name = 'video without auto-blacklist ' + buildUUID()
// admin with blacklist right will not be auto-blacklisted
- const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name })
- const uuid = resVideo.body.video.uuid
+ const { uuid } = await servers[0].videos.upload({ attributes: { name } })
await waitJobs(servers)
await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, uuid, name, 'absence')
})
after(async () => {
await waitJobs(servers)
await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, uuid, name, 'absence')
})
after(async () => {
- await servers[0].subscriptionsCommand.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
- await servers[1].subscriptionsCommand.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
+ await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
+ await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })