-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import * as chai from 'chai'
import 'mocha'
import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
import { User } from '../../../../shared/models/users'
import { VideoDetails } from '../../../../shared/models/videos'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
const expect = chai.expect
}
let firstUserAccessToken = ''
let secondUserAccessToken = ''
- let lastRequestChangeOwnershipId = undefined
+ let lastRequestChangeOwnershipId = ''
before(async function () {
this.timeout(50000)
const videoQuota = 42000000
await createUser({
- url: servers[ 0 ].url,
- accessToken: servers[ 0 ].accessToken,
+ url: servers[0].url,
+ accessToken: servers[0].accessToken,
username: firstUser.username,
password: firstUser.password,
videoQuota: videoQuota
})
await createUser({
- url: servers[ 0 ].url,
- accessToken: servers[ 0 ].accessToken,
+ url: servers[0].url,
+ accessToken: servers[0].accessToken,
username: secondUser.username,
password: secondUser.password,
videoQuota: videoQuota
it('Should not be possible to refuse the change of ownership from first user', async function () {
this.timeout(10000)
- await refuseChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, 403)
+ await refuseChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, HttpStatusCode.FORBIDDEN_403)
})
it('Should be possible to refuse the change of ownership from second user', async function () {
const secondUserInformationResponse = await getMyUserInformation(servers[0].url, secondUserAccessToken)
const secondUserInformation: User = secondUserInformationResponse.body
const channelId = secondUserInformation.videoChannels[0].id
- await acceptChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, channelId, 403)
+ await acceptChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, channelId, HttpStatusCode.FORBIDDEN_403)
})
it('Should be possible to accept the change of ownership from second user', async function () {
await waitJobs(servers)
})
- it('Should have video channel updated', async function () {
+ it('Should have the channel of the video updated', async function () {
for (const server of servers) {
const res = await getVideo(server.url, servers[0].video.uuid)
})
describe('Test video change ownership - quota too small', function () {
- let server: ServerInfo = undefined
+ let server: ServerInfo
const firstUser = {
username: 'first',
password: 'My great password'
}
let firstUserAccessToken = ''
let secondUserAccessToken = ''
- let lastRequestChangeOwnershipId = undefined
+ let lastRequestChangeOwnershipId = ''
before(async function () {
this.timeout(50000)
// Run one server
server = await flushAndRunServer(1)
- await setAccessTokensToServers([server])
+ await setAccessTokensToServers([ server ])
const videoQuota = 42000000
const limitedVideoQuota = 10
const secondUserInformationResponse = await getMyUserInformation(server.url, secondUserAccessToken)
const secondUserInformation: User = secondUserInformationResponse.body
const channelId = secondUserInformation.videoChannels[0].id
- await acceptChangeOwnership(server.url, secondUserAccessToken, lastRequestChangeOwnershipId, channelId, 403)
+
+ await acceptChangeOwnership(
+ server.url,
+ secondUserAccessToken,
+ lastRequestChangeOwnershipId,
+ channelId,
+ HttpStatusCode.PAYLOAD_TOO_LARGE_413
+ )
})
after(async function () {