/* tslint:disable:no-unused-expression */
import * as request from 'supertest'
-import { join } from 'path'
import 'mocha'
import * as chai from 'chai'
const expect = chai.expect
makePutBodyRequest,
setAccessTokensToServers,
killallServers,
- getMyUserInformation,
makePostBodyRequest,
getVideoChannelsList,
createUser,
- getUserAccessToken
+ userLogin
} from '../../utils'
describe('Test videos API validator', function () {
const path = '/api/v1/videos/channels'
let server: ServerInfo
- let channelId: number
let accessTokenUser: string
// ---------------------------------------------------------------
await setAccessTokensToServers([ server ])
- const res = await getMyUserInformation(server.url, server.accessToken)
- channelId = res.body.videoChannels[0].id
-
const user = {
username: 'fake',
password: 'fake_password'
}
await createUser(server.url, server.accessToken, user.username, user.password)
- accessTokenUser = await getUserAccessToken(server, user)
+ accessTokenUser = await userLogin(server, user)
})
describe('When listing a video channels', function () {
})
})
- describe('When listing author video channels', function () {
- it('Should fail with bad author', async function () {
- const path = '/api/v1/videos/authors/hello/channels'
+ describe('When listing account video channels', function () {
+ it('Should fail with bad account', async function () {
+ const path = '/api/v1/videos/accounts/hello/channels'
await request(server.url)
.get(path)
.expect(400)
})
- it('Should fail with a unknown author', async function () {
- const path = '/api/v1/videos/authors/156/channels'
+ it('Should fail with a unknown account', async function () {
+ const path = '/api/v1/videos/accounts/156/channels'
await request(server.url)
.get(path)
it('Should fail with a long name', async function () {
const fields = {
name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
+ 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
+ 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
+ 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',
description: 'super description'
}
it('Should fail with a long name', async function () {
const fields = {
name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
+ 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
+ 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
+ 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +
'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',
description: 'super description'
}