import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/core-utils'
-import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils'
-import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
+import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
+import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
const expect = chai.expect
describe('Test follow constraints', function () {
- let servers: ServerInfo[] = []
+ let servers: PeerTubeServer[] = []
let video1UUID: string
let video2UUID: string
let userToken: string
before(async function () {
- this.timeout(90000)
+ this.timeout(240000)
- servers = await flushAndRunMultipleServers(2)
+ servers = await createMultipleServers(2)
// Get the access tokens
await setAccessTokensToServers(servers)
})
it('Should list local account videos', async function () {
- const { total, data } = await servers[0].videos.listByAccount({ accountName: 'root@localhost:' + servers[0].port })
+ const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[0].port })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list remote account videos', async function () {
- const { total, data } = await servers[0].videos.listByAccount({ accountName: 'root@localhost:' + servers[1].port })
+ const { total, data } = await servers[0].videos.listByAccount({ handle: 'root@localhost:' + servers[1].port })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list local channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[0].port
- const { total, data } = await servers[0].videos.listByChannel({ videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[0].port
+ const { total, data } = await servers[0].videos.listByChannel({ handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list remote channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[1].port
- const { total, data } = await servers[0].videos.listByChannel({ videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[1].port
+ const { total, data } = await servers[0].videos.listByChannel({ handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list local account videos', async function () {
- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, accountName: 'root@localhost:' + servers[0].port })
+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list remote account videos', async function () {
- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, accountName: 'root@localhost:' + servers[1].port })
+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list local channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[0].port
- const { total, data } = await servers[0].videos.listByChannel({ token: userToken, videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[0].port
+ const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list remote channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[1].port
- const { total, data } = await servers[0].videos.listByChannel({ token: userToken, videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[1].port
+ const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({
- token: undefined,
- accountName: 'root@localhost:' + servers[0].port
+ token: null,
+ handle: 'root@localhost:' + servers[0].port
})
expect(total).to.equal(1)
it('Should not list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({
- token: undefined,
- accountName: 'root@localhost:' + servers[1].port
+ token: null,
+ handle: 'root@localhost:' + servers[1].port
})
expect(total).to.equal(0)
})
it('Should list local channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[0].port
- const { total, data } = await servers[0].videos.listByChannel({ token: undefined, videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[0].port
+ const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should not list remote channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[1].port
- const { total, data } = await servers[0].videos.listByChannel({ token: undefined, videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[1].port
+ const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(0)
expect(data).to.have.lengthOf(0)
})
it('Should list local account videos', async function () {
- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, accountName: 'root@localhost:' + servers[0].port })
+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[0].port })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list remote account videos', async function () {
- const { total, data } = await servers[0].videos.listByAccount({ token: userToken, accountName: 'root@localhost:' + servers[1].port })
+ const { total, data } = await servers[0].videos.listByAccount({ token: userToken, handle: 'root@localhost:' + servers[1].port })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list local channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[0].port
- const { total, data } = await servers[0].videos.listByChannel({ token: userToken, videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[0].port
+ const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
})
it('Should list remote channel videos', async function () {
- const videoChannelName = 'root_channel@localhost:' + servers[1].port
- const { total, data } = await servers[0].videos.listByChannel({ token: userToken, videoChannelName })
+ const handle = 'root_channel@localhost:' + servers[1].port
+ const { total, data } = await servers[0].videos.listByChannel({ token: userToken, handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)