/* tslint:disable:no-unused-expression */
+
import * as chai from 'chai'
import 'mocha'
import { UserRole } from '../../../shared'
} from '../utils'
import { follow } from '../utils/follows'
import { getMyVideos } from '../utils/videos'
+import { setAccessTokensToServers } from '../utils/login'
const expect = chai.expect
let userId: number
before(async function () {
- this.timeout(120000)
+ this.timeout(10000)
await flushTests()
server = await runServer(1)
+
+ await setAccessTokensToServers([ server ])
})
it('Should create a new client')
it('Should upload the video with the correct token', async function () {
const videoAttributes = {}
- await uploadVideo(server.url, accessToken, videoAttributes, 204)
+ await uploadVideo(server.url, accessToken, videoAttributes)
const res = await getVideosList(server.url)
const video = res.body.data[ 0 ]
- expect(video.account)
+ expect(video.accountName)
.to
.equal('root')
videoId = video.id
it('Should upload the video again with the correct token', async function () {
const videoAttributes = {}
- await uploadVideo(server.url, accessToken, videoAttributes, 204)
+ await uploadVideo(server.url, accessToken, videoAttributes)
})
it('Should retrieve a video rating', async function () {
})
it('Should list all the users', async function () {
- const res = await getUsersList(server.url)
+ const res = await getUsersList(server.url, server.accessToken)
const result = res.body
const total = result.total
const users = result.data
})
it('Should list only the first user by username asc', async function () {
- const res = await getUsersListPaginationAndSort(server.url, 0, 1, 'username')
+ const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, 'username')
const result = res.body
const total = result.total
})
it('Should list only the first user by username desc', async function () {
- const res = await getUsersListPaginationAndSort(server.url, 0, 1, '-username')
+ const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-username')
const result = res.body
const total = result.total
const users = result.data
})
it('Should list only the second user by createdAt desc', async function () {
- const res = await getUsersListPaginationAndSort(server.url, 0, 1, '-createdAt')
+ const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 1, '-createdAt')
const result = res.body
const total = result.total
const users = result.data
})
it('Should list all the users by createdAt asc', async function () {
- const res = await getUsersListPaginationAndSort(server.url, 0, 2, 'createdAt')
+ const res = await getUsersListPaginationAndSort(server.url, server.accessToken, 0, 2, 'createdAt')
const result = res.body
const total = result.total
const users = result.data
.a('number')
})
+ it('Should be able to change the autoPlayVideo attribute', async function () {
+ await updateMyUser(server.url, accessTokenUser, undefined, undefined, undefined, false)
+
+ const res = await getMyUserInformation(server.url, accessTokenUser)
+ const user = res.body
+
+ expect(user.autoPlayVideo).to.be.false
+ })
+
it('Should be able to change the email display attribute', async function () {
await updateMyUser(server.url, accessTokenUser, undefined, undefined, 'updated@example.com')
.equal(1)
const video = res.body.data[ 0 ]
- expect(video.account)
+ expect(video.accountName)
.to
.equal('root')
})