import 'mocha'
import { omit } from 'lodash'
-import { User, UserRole } from '../../../../shared'
+import { User, UserRole, VideoCreateResult } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import {
- addVideoChannel,
blockUser,
buildAbsoluteFixturePath,
cleanupTests,
uploadVideo,
userLogin
} from '../../../../shared/extra-utils'
-import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'
+import { MockSmtpServer } from '../../../../shared/extra-utils/mock-servers/mock-email'
import {
checkBadCountPagination,
checkBadSortPagination,
let userId: number
let rootId: number
let moderatorId: number
- let videoId: number
+ let video: VideoCreateResult
let server: ServerInfo
let serverWithRegistrationDisabled: ServerInfo
let userAccessToken = ''
{
const res = await uploadVideo(server.url, server.accessToken, {})
- videoId = res.body.video.id
+ video = res.body.video
}
{
describe('When getting my video rating', function () {
it('Should fail with a non authenticated user', async function () {
- await getMyUserVideoRating(server.url, 'fake_token', videoId, HttpStatusCode.UNAUTHORIZED_401)
+ await getMyUserVideoRating(server.url, 'fake_token', video.id, HttpStatusCode.UNAUTHORIZED_401)
})
it('Should fail with an incorrect video uuid', async function () {
})
it('Should succeed with the correct parameters', async function () {
- await getMyUserVideoRating(server.url, server.accessToken, videoId)
+ await getMyUserVideoRating(server.url, server.accessToken, video.id)
+ await getMyUserVideoRating(server.url, server.accessToken, video.uuid)
+ await getMyUserVideoRating(server.url, server.accessToken, video.shortUUID)
})
})
})
it('Should fail with an existing channel', async function () {
- const videoChannelAttributesArg = { name: 'existing_channel', displayName: 'hello', description: 'super description' }
- await addVideoChannel(server.url, server.accessToken, videoChannelAttributesArg)
+ const attributes = { name: 'existing_channel', displayName: 'hello', description: 'super description' }
+ await server.channelsCommand.create({ attributes })
const fields = immutableAssign(baseCorrectParams, { channel: { name: 'existing_channel', displayName: 'toto' } })