Fix video full description
This commit is contained in:
parent
afffe98839
commit
975e6e0e44
|
@ -193,8 +193,12 @@ function fetchRemoteVideoPreview (video: VideoInstance) {
|
|||
}
|
||||
|
||||
async function fetchRemoteVideoDescription (video: VideoInstance) {
|
||||
// FIXME: use url
|
||||
const host = video.VideoChannel.Account.Server.host
|
||||
const path = video.getDescriptionPath()
|
||||
const options = {
|
||||
uri: video.url
|
||||
uri: REMOTE_SCHEME.HTTP + '://' + host + path,
|
||||
json: true
|
||||
}
|
||||
|
||||
const { body } = await doRequest(options)
|
||||
|
|
|
@ -1,292 +0,0 @@
|
|||
/* tslint:disable:no-unused-expression */
|
||||
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
const expect = chai.expect
|
||||
|
||||
import {
|
||||
ServerInfo,
|
||||
flushTests,
|
||||
runServer,
|
||||
uploadVideo,
|
||||
quitFriends,
|
||||
getVideosList,
|
||||
wait,
|
||||
setAccessTokensToServers,
|
||||
flushAndRunMultipleServers,
|
||||
killallServers,
|
||||
makeFriends,
|
||||
getFriendsList,
|
||||
quitOneFriend
|
||||
} from '../utils'
|
||||
|
||||
describe('Test advanced friends', function () {
|
||||
let servers: ServerInfo[] = []
|
||||
|
||||
async function makeFriendsWrapper (podNumber: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
return makeFriends(server.url, server.accessToken)
|
||||
}
|
||||
|
||||
async function quitFriendsWrapper (podNumber: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
return quitFriends(server.url, server.accessToken)
|
||||
}
|
||||
|
||||
async function removeFriendWrapper (podNumber: number, podNumberToRemove: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
const serverToRemove = servers[podNumberToRemove - 1]
|
||||
|
||||
const res = await getFriendsList(server.url)
|
||||
|
||||
let friendsList = res.body.data
|
||||
let podToRemove = friendsList.find(friend => (friend.host === serverToRemove.host))
|
||||
|
||||
return quitOneFriend(server.url, server.accessToken, podToRemove.id)
|
||||
}
|
||||
|
||||
async function getFriendsListWrapper (podNumber: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
return getFriendsList(server.url)
|
||||
}
|
||||
|
||||
async function uploadVideoWrapper (podNumber: number) {
|
||||
const videoAttributes = {
|
||||
tags: [ 'tag1', 'tag2' ]
|
||||
}
|
||||
const server = servers[podNumber - 1]
|
||||
|
||||
return uploadVideo(server.url, server.accessToken, videoAttributes)
|
||||
}
|
||||
|
||||
async function getVideosWrapper (podNumber: number) {
|
||||
return getVideosList(servers[podNumber - 1].url)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
before(async function () {
|
||||
this.timeout(120000)
|
||||
|
||||
servers = await flushAndRunMultipleServers(6)
|
||||
await setAccessTokensToServers(servers)
|
||||
})
|
||||
|
||||
it('Should not make friends with two different groups', async function () {
|
||||
this.timeout(20000)
|
||||
|
||||
// Pod 3 makes friend with the first one
|
||||
await makeFriendsWrapper(3)
|
||||
|
||||
// Pod 4 makes friend with the second one
|
||||
await makeFriendsWrapper(4)
|
||||
|
||||
// Now if the fifth wants to make friends with the third and the first
|
||||
await makeFriendsWrapper(5)
|
||||
|
||||
await wait(11000)
|
||||
|
||||
// It should have 0 friends
|
||||
const res = await getFriendsListWrapper(5)
|
||||
expect(res.body.data.length).to.equal(0)
|
||||
})
|
||||
|
||||
it('Should quit all friends', async function () {
|
||||
this.timeout(10000)
|
||||
|
||||
await quitFriendsWrapper(1)
|
||||
await quitFriendsWrapper(2)
|
||||
|
||||
const serverNumbersToTest = [ 1, 2, 3, 4, 5, 6 ]
|
||||
for (const i of serverNumbersToTest) {
|
||||
const res = await getFriendsListWrapper(i)
|
||||
expect(res.body.data.length).to.equal(0)
|
||||
}
|
||||
})
|
||||
|
||||
it('Should remove bad pod and new pod should not become friend with it', async function () {
|
||||
this.timeout(200000)
|
||||
|
||||
// Pods 1, 2, 3 and 4 become friends
|
||||
await makeFriendsWrapper(2)
|
||||
await makeFriendsWrapper(1)
|
||||
await makeFriendsWrapper(4)
|
||||
|
||||
// Check the pods 1, 2, 3 and 4 are friends
|
||||
let serverNumbersToTest = [ 1, 2, 3, 4 ]
|
||||
for (const i of serverNumbersToTest) {
|
||||
const res = await getFriendsListWrapper(i)
|
||||
expect(res.body.data.length).to.equal(3)
|
||||
}
|
||||
|
||||
// Wait initial video channel requests
|
||||
await wait(11000)
|
||||
|
||||
// Kill pod 4
|
||||
servers[3].app.kill()
|
||||
|
||||
// Remove pod 4 from pod 1 and 2
|
||||
await uploadVideoWrapper(1)
|
||||
await uploadVideoWrapper(2)
|
||||
|
||||
await wait(11000)
|
||||
|
||||
await uploadVideoWrapper(1)
|
||||
await uploadVideoWrapper(2)
|
||||
|
||||
await wait(11000)
|
||||
|
||||
await uploadVideoWrapper(1)
|
||||
await uploadVideoWrapper(2)
|
||||
|
||||
await wait(11000)
|
||||
|
||||
await uploadVideoWrapper(1)
|
||||
await uploadVideoWrapper(2)
|
||||
|
||||
await wait(11000)
|
||||
|
||||
serverNumbersToTest = [ 1, 2 ]
|
||||
|
||||
for (const i of serverNumbersToTest) {
|
||||
const res = await getFriendsListWrapper(i)
|
||||
|
||||
// Pod 4 should not be our friend
|
||||
const friends = res.body.data
|
||||
expect(friends.length).to.equal(2)
|
||||
|
||||
for (const pod of friends) {
|
||||
expect(pod.host).not.equal(servers[3].host)
|
||||
}
|
||||
}
|
||||
|
||||
// Rerun server 4
|
||||
const newServer = await runServer(4)
|
||||
servers[3].app = newServer.app
|
||||
servers[3].app
|
||||
|
||||
// Pod 4 didn't know pod 1 and 2 removed it
|
||||
const res1 = await getFriendsListWrapper(4)
|
||||
expect(res1.body.data.length).to.equal(3)
|
||||
|
||||
// Pod 3 didn't upload video, it's still friend with pod 3
|
||||
const res2 = await getFriendsListWrapper(3)
|
||||
expect(res2.body.data.length).to.equal(3)
|
||||
|
||||
// Pod 6 asks pod 1, 2 and 3
|
||||
await makeFriendsWrapper(6)
|
||||
|
||||
await wait(11000)
|
||||
|
||||
const res3 = await getFriendsListWrapper(6)
|
||||
|
||||
// Pod 4 should not be our friend
|
||||
const friends = res3.body.data
|
||||
expect(friends.length).to.equal(3)
|
||||
for (const pod of friends) {
|
||||
expect(pod.host).not.equal(servers[3].host)
|
||||
}
|
||||
})
|
||||
|
||||
// Pod 1 is friend with : 2 3 6
|
||||
// Pod 2 is friend with : 1 3 6
|
||||
// Pod 3 is friend with : 1 2 4 6
|
||||
// Pod 4 is friend with : 1 2 3
|
||||
// Pod 6 is friend with : 1 2 3
|
||||
it('Should pod 1 quit friends', async function () {
|
||||
this.timeout(25000)
|
||||
|
||||
// Upload a video on server 3 for additional tests
|
||||
await uploadVideoWrapper(3)
|
||||
|
||||
await wait(15000)
|
||||
|
||||
// Pod 1 remove friends
|
||||
await quitFriendsWrapper(1)
|
||||
|
||||
const res1 = await getVideosWrapper(1)
|
||||
const videos1 = res1.body.data
|
||||
expect(videos1).to.be.an('array')
|
||||
expect(videos1.length).to.equal(4)
|
||||
|
||||
const res2 = await getVideosWrapper(2)
|
||||
const videos2 = res2.body.data
|
||||
expect(videos2).to.be.an('array')
|
||||
expect(videos2.length).to.equal(5)
|
||||
})
|
||||
|
||||
// Pod 1 is friend with nothing
|
||||
// Pod 2 is friend with : 3 6
|
||||
// Pod 3 is friend with : 2 4 6
|
||||
// Pod 4 is friend with : 2 3
|
||||
// Pod 6 is friend with : 2 3
|
||||
it('Should make friends between pod 1, 2, 3 and 6 and exchange their videos', async function () {
|
||||
this.timeout(30000)
|
||||
|
||||
await makeFriendsWrapper(1)
|
||||
|
||||
await wait(22000)
|
||||
|
||||
const res = await getVideosWrapper(1)
|
||||
const videos = res.body.data
|
||||
expect(videos).to.be.an('array')
|
||||
expect(videos.length).to.equal(9)
|
||||
})
|
||||
|
||||
// Pod 1 is friend with : 2 3 6
|
||||
// Pod 2 is friend with : 1 3 6
|
||||
// Pod 3 is friend with : 1 2 4 6
|
||||
// Pod 4 is friend with : 2 3
|
||||
// Pod 6 is friend with : 1 2 3
|
||||
it('Should allow pod 6 to quit pod 1, 2 and 3 and be friend with pod 3', async function () {
|
||||
this.timeout(30000)
|
||||
|
||||
// Pod 3 should have 4 friends
|
||||
const res1 = await getFriendsListWrapper(3)
|
||||
const friendsList1 = res1.body.data
|
||||
expect(friendsList1).to.be.an('array')
|
||||
expect(friendsList1.length).to.equal(4)
|
||||
|
||||
// Pod 1, 2, 6 should have 3 friends each
|
||||
let serverNumbersToTest = [ 1, 2, 6 ]
|
||||
for (const i of serverNumbersToTest) {
|
||||
const res = await getFriendsListWrapper(i)
|
||||
const friendsList = res.body.data
|
||||
expect(friendsList).to.be.an('array')
|
||||
expect(friendsList.length).to.equal(3)
|
||||
}
|
||||
|
||||
await removeFriendWrapper(6, 1)
|
||||
await removeFriendWrapper(6, 2)
|
||||
|
||||
// Pod 6 should now have only 1 friend (and it should be Pod 3)
|
||||
const res2 = await getFriendsListWrapper(6)
|
||||
const friendsList2 = res2.body.data
|
||||
expect(friendsList2).to.be.an('array')
|
||||
expect(friendsList2.length).to.equal(1)
|
||||
expect(friendsList2[0].host).to.equal(servers[2].host)
|
||||
|
||||
// Pod 1 & 2 should not know friend 6 anymore
|
||||
serverNumbersToTest = [ 1, 2 ]
|
||||
for (const i of serverNumbersToTest) {
|
||||
const res = await getFriendsListWrapper(i)
|
||||
const friendsList = res.body.data
|
||||
expect(friendsList).to.be.an('array')
|
||||
expect(friendsList.length).to.equal(2)
|
||||
}
|
||||
|
||||
// Pod 3 should know every pod
|
||||
const res3 = await getFriendsListWrapper(3)
|
||||
const friendsList3 = res3.body.data
|
||||
expect(friendsList3).to.be.an('array')
|
||||
expect(friendsList3.length).to.equal(4)
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
killallServers(servers)
|
||||
|
||||
if (this['ok']) {
|
||||
await flushTests()
|
||||
}
|
||||
})
|
||||
})
|
|
@ -1,220 +0,0 @@
|
|||
/* tslint:disable:no-unused-expression */
|
||||
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
const expect = chai.expect
|
||||
|
||||
import {
|
||||
ServerInfo,
|
||||
flushTests,
|
||||
quitFriends,
|
||||
wait,
|
||||
setAccessTokensToServers,
|
||||
flushAndRunMultipleServers,
|
||||
killallServers,
|
||||
makeFriends,
|
||||
getFriendsList,
|
||||
dateIsValid,
|
||||
quitOneFriend,
|
||||
getPodsListPaginationAndSort
|
||||
} from '../utils'
|
||||
|
||||
describe('Test basic friends', function () {
|
||||
let servers = []
|
||||
|
||||
function makeFriendsWrapper (podNumber: number) {
|
||||
const server = servers[podNumber - 1]
|
||||
return makeFriends(server.url, server.accessToken)
|
||||
}
|
||||
|
||||
async function testMadeFriends (servers: ServerInfo[], serverToTest: ServerInfo) {
|
||||
const friends = []
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
if (servers[i].url === serverToTest.url) continue
|
||||
friends.push(servers[i].host)
|
||||
}
|
||||
|
||||
const res = await getFriendsList(serverToTest.url)
|
||||
|
||||
const result = res.body.data
|
||||
expect(result).to.be.an('array')
|
||||
expect(result.length).to.equal(2)
|
||||
|
||||
const resultHosts = [ result[0].host, result[1].host ]
|
||||
expect(resultHosts[0]).to.not.equal(resultHosts[1])
|
||||
|
||||
const errorString = 'Friends host do not correspond for ' + serverToTest.host
|
||||
expect(friends).to.contain(resultHosts[0], errorString)
|
||||
expect(friends).to.contain(resultHosts[1], errorString)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
before(async function () {
|
||||
this.timeout(120000)
|
||||
|
||||
servers = await flushAndRunMultipleServers(3)
|
||||
|
||||
await setAccessTokensToServers(servers)
|
||||
})
|
||||
|
||||
it('Should not have friends', async function () {
|
||||
for (const server of servers) {
|
||||
const res = await getFriendsList(server.url)
|
||||
|
||||
const result = res.body.data
|
||||
expect(result).to.be.an('array')
|
||||
expect(result.length).to.equal(0)
|
||||
}
|
||||
})
|
||||
|
||||
it('Should make friends', async function () {
|
||||
this.timeout(120000)
|
||||
|
||||
// The second pod make friend with the third
|
||||
await makeFriendsWrapper(2)
|
||||
|
||||
// Wait for the request between pods
|
||||
await wait(11000)
|
||||
|
||||
// The second pod should have the third as a friend
|
||||
const res1 = await getFriendsList(servers[1].url)
|
||||
|
||||
const friends = res1.body.data
|
||||
expect(friends).to.be.an('array')
|
||||
expect(friends.length).to.equal(1)
|
||||
|
||||
const pod1 = friends[0]
|
||||
expect(pod1.host).to.equal(servers[2].host)
|
||||
expect(pod1.email).to.equal('admin3@example.com')
|
||||
expect(pod1.score).to.be.at.least(20)
|
||||
expect(dateIsValid(pod1.createdAt)).to.be.true
|
||||
|
||||
// Same here, the third pod should have the second pod as a friend
|
||||
const res2 = await getFriendsList(servers[2].url)
|
||||
const result = res2.body.data
|
||||
expect(result).to.be.an('array')
|
||||
expect(result.length).to.equal(1)
|
||||
|
||||
const pod2 = result[0]
|
||||
expect(pod2.host).to.equal(servers[1].host)
|
||||
expect(pod2.email).to.equal('admin2@example.com')
|
||||
expect(pod2.score).to.be.at.least(20)
|
||||
expect(dateIsValid(pod2.createdAt)).to.be.true
|
||||
|
||||
// Finally the first pod make friend with the second pod
|
||||
await makeFriendsWrapper(1)
|
||||
|
||||
// Wait for the request between pods
|
||||
await wait(11000)
|
||||
|
||||
// Now each pod should be friend with the other ones
|
||||
for (const server of servers) {
|
||||
await testMadeFriends(servers, server)
|
||||
}
|
||||
})
|
||||
|
||||
it('Should not be allowed to make friend again', async function () {
|
||||
this.timeout(10000)
|
||||
|
||||
const server = servers[1]
|
||||
await makeFriends(server.url, server.accessToken, 409)
|
||||
})
|
||||
|
||||
it('Should list friends correctly', async function () {
|
||||
const start = 1
|
||||
const count = 1
|
||||
const sort = '-host'
|
||||
|
||||
const res = await getPodsListPaginationAndSort(servers[0].url, start, count, sort)
|
||||
expect(res.body.total).to.equal(2)
|
||||
expect(res.body.data).to.have.lengthOf(1)
|
||||
|
||||
const pod = res.body.data[0]
|
||||
expect(pod.host).to.equal('localhost:9002')
|
||||
expect(pod.email).to.equal('admin2@example.com')
|
||||
expect(pod.score).to.be.at.least(20)
|
||||
expect(dateIsValid(pod.createdAt)).to.be.true
|
||||
})
|
||||
|
||||
it('Should quit friends of pod 2', async function () {
|
||||
this.timeout(10000)
|
||||
|
||||
// Pod 1 quit friends
|
||||
await quitFriends(servers[1].url, servers[1].accessToken)
|
||||
|
||||
// Pod 1 should not have friends anymore
|
||||
const res = await getFriendsList(servers[1].url)
|
||||
const friends = res.body.data
|
||||
expect(friends).to.be.an('array')
|
||||
expect(friends).to.have.lengthOf(0)
|
||||
|
||||
// Other pods shouldn't have pod 1 too
|
||||
const serversToTest = [ servers[0].url, servers[2].url ]
|
||||
for (const url of serversToTest) {
|
||||
const res = await getFriendsList(url)
|
||||
const friends = res.body.data
|
||||
|
||||
expect(friends).to.be.an('array')
|
||||
expect(friends.length).to.equal(1)
|
||||
expect(friends[0].host).not.to.be.equal(servers[1].host)
|
||||
}
|
||||
})
|
||||
|
||||
it('Should allow pod 2 to make friend again', async function () {
|
||||
this.timeout(120000)
|
||||
|
||||
const server = servers[1]
|
||||
await makeFriends(server.url, server.accessToken)
|
||||
await wait(11000)
|
||||
|
||||
for (const server of servers) {
|
||||
await testMadeFriends(servers, server)
|
||||
}
|
||||
})
|
||||
|
||||
it('Should allow pod 1 to quit only pod 2', async function () {
|
||||
// Pod 1 quits pod 2
|
||||
const server = servers[0]
|
||||
|
||||
// Get pod 2 id so we can query it
|
||||
const res1 = await getFriendsList(server.url)
|
||||
const friends1 = res1.body.data
|
||||
let pod1 = friends1.find(friend => (friend.host === servers[1].host))
|
||||
|
||||
// Remove it from the friends list
|
||||
await quitOneFriend(server.url, server.accessToken, pod1.id)
|
||||
|
||||
// Pod 1 should have only pod 3 in its friends list
|
||||
const res2 = await getFriendsList(servers[0].url)
|
||||
const friends2 = res2.body.data
|
||||
expect(friends2).to.be.an('array')
|
||||
expect(friends2.length).to.equal(1)
|
||||
|
||||
const pod2 = friends2[0]
|
||||
expect(pod2.host).to.equal(servers[2].host)
|
||||
|
||||
// Pod 2 should have only pod 3 in its friends list
|
||||
const res3 = await getFriendsList(servers[1].url)
|
||||
const friends3 = res3.body.data
|
||||
expect(friends3).to.be.an('array')
|
||||
expect(friends3.length).to.equal(1)
|
||||
|
||||
const pod = friends3[0]
|
||||
expect(pod.host).to.equal(servers[2].host)
|
||||
|
||||
// Pod 3 should have both pods in its friends list
|
||||
const res4 = await getFriendsList(servers[2].url)
|
||||
const friends4 = res4.body.data
|
||||
expect(friends4).to.be.an('array')
|
||||
expect(friends4.length).to.equal(2)
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
killallServers(servers)
|
||||
|
||||
if (this['ok']) {
|
||||
await flushTests()
|
||||
}
|
||||
})
|
||||
})
|
|
@ -1,7 +1,6 @@
|
|||
// Order of the tests we want to execute
|
||||
import './config'
|
||||
import './check-params'
|
||||
import './friends-basic'
|
||||
import './users'
|
||||
import './single-pod'
|
||||
import './video-abuse'
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// Order of the tests we want to execute
|
||||
import './multiple-pods'
|
||||
import './friends-advanced'
|
||||
import './video-transcoder'
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
/* tslint:disable:no-unused-expressions */
|
||||
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
const expect = chai.expect
|
||||
import * as lodash from 'lodash'
|
||||
const orderBy = lodash.orderBy
|
||||
|
||||
import 'mocha'
|
||||
import {
|
||||
ServerInfo,
|
||||
flushTests,
|
||||
wait,
|
||||
setAccessTokensToServers,
|
||||
flushAndRunMultipleServers,
|
||||
killallServers,
|
||||
makeFriends,
|
||||
getVideosList,
|
||||
uploadVideo,
|
||||
addVideoToBlacklist,
|
||||
removeVideoFromBlacklist,
|
||||
flushAndRunMultipleServers,
|
||||
flushTests,
|
||||
getBlacklistedVideosList,
|
||||
getSortedBlacklistedVideosList
|
||||
getSortedBlacklistedVideosList,
|
||||
getVideosList,
|
||||
killallServers,
|
||||
removeVideoFromBlacklist,
|
||||
ServerInfo,
|
||||
setAccessTokensToServers,
|
||||
uploadVideo,
|
||||
wait
|
||||
} from '../utils'
|
||||
import { doubleFollow } from '../utils/follows'
|
||||
|
||||
const expect = chai.expect
|
||||
const orderBy = lodash.orderBy
|
||||
|
||||
describe('Test video blacklist management', function () {
|
||||
let servers: ServerInfo[] = []
|
||||
|
||||
async function blacklistVideosOnPod (server: ServerInfo) {
|
||||
async function blacklistVideosOnServer (server: ServerInfo) {
|
||||
const res = await getVideosList(server.url)
|
||||
|
||||
const videos = res.body.data
|
||||
|
@ -43,18 +43,18 @@ describe('Test video blacklist management', function () {
|
|||
// Get the access tokens
|
||||
await setAccessTokensToServers(servers)
|
||||
|
||||
// Pod 1 makes friend with pod 2
|
||||
await makeFriends(servers[0].url, servers[0].accessToken)
|
||||
// Server 1 and server 2 follow each other
|
||||
await doubleFollow(servers[0], servers[1])
|
||||
|
||||
// Upload 2 videos on pod 2
|
||||
await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 1st video', description: 'A video on pod 2' })
|
||||
await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 2nd video', description: 'A video on pod 2' })
|
||||
// Upload 2 videos on server 2
|
||||
await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 1st video', description: 'A video on server 2' })
|
||||
await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 2nd video', description: 'A video on server 2' })
|
||||
|
||||
// Wait videos propagation
|
||||
await wait(22000)
|
||||
await wait(50000)
|
||||
|
||||
// Blacklist the two videos on pod 1
|
||||
await blacklistVideosOnPod(servers[0])
|
||||
// Blacklist the two videos on server 1
|
||||
await blacklistVideosOnServer(servers[0])
|
||||
})
|
||||
|
||||
describe('When listing blacklisted videos', function () {
|
||||
|
@ -112,14 +112,14 @@ describe('Test video blacklist management', function () {
|
|||
let videoToRemove
|
||||
let blacklist = []
|
||||
|
||||
it('Should not have any video in videos list on pod 1', async function () {
|
||||
it('Should not have any video in videos list on server 1', async function () {
|
||||
const res = await getVideosList(servers[0].url)
|
||||
expect(res.body.total).to.equal(0)
|
||||
expect(res.body.data).to.be.an('array')
|
||||
expect(res.body.data.length).to.equal(0)
|
||||
})
|
||||
|
||||
it('Should remove a video from the blacklist on pod 1', async function () {
|
||||
it('Should remove a video from the blacklist on server 1', async function () {
|
||||
// Get one video in the blacklist
|
||||
const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-name')
|
||||
videoToRemove = res.body.data[0]
|
||||
|
@ -129,7 +129,7 @@ describe('Test video blacklist management', function () {
|
|||
await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoToRemove.videoId)
|
||||
})
|
||||
|
||||
it('Should have the ex-blacklisted video in videos list on pod 1', async function () {
|
||||
it('Should have the ex-blacklisted video in videos list on server 1', async function () {
|
||||
const res = await getVideosList(servers[0].url)
|
||||
expect(res.body.total).to.equal(1)
|
||||
|
||||
|
@ -141,7 +141,7 @@ describe('Test video blacklist management', function () {
|
|||
expect(videos[0].id).to.equal(videoToRemove.videoId)
|
||||
})
|
||||
|
||||
it('Should not have the ex-blacklisted video in videos blacklist list on pod 1', async function () {
|
||||
it('Should not have the ex-blacklisted video in videos blacklist list on server 1', async function () {
|
||||
const res = await getSortedBlacklistedVideosList(servers[0].url, servers[0].accessToken, '-name')
|
||||
expect(res.body.total).to.equal(1)
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/* tslint:disable:no-unused-expression */
|
||||
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
const expect = chai.expect
|
||||
|
||||
import 'mocha'
|
||||
import {
|
||||
ServerInfo,
|
||||
flushTests,
|
||||
uploadVideo,
|
||||
makeFriends,
|
||||
getVideosList,
|
||||
wait,
|
||||
setAccessTokensToServers,
|
||||
flushAndRunMultipleServers,
|
||||
addVideoToBlacklist,
|
||||
flushAndRunMultipleServers,
|
||||
flushTests,
|
||||
getVideosList,
|
||||
killallServers,
|
||||
searchVideo,
|
||||
killallServers
|
||||
ServerInfo,
|
||||
setAccessTokensToServers,
|
||||
uploadVideo,
|
||||
wait
|
||||
} from '../utils'
|
||||
import { doubleFollow } from '../utils/follows'
|
||||
|
||||
const expect = chai.expect
|
||||
|
||||
describe('Test video blacklists', function () {
|
||||
let servers: ServerInfo[] = []
|
||||
|
@ -30,32 +30,32 @@ describe('Test video blacklists', function () {
|
|||
// Get the access tokens
|
||||
await setAccessTokensToServers(servers)
|
||||
|
||||
// Pod 1 makes friend with pod 2
|
||||
await makeFriends(servers[0].url, servers[0].accessToken)
|
||||
// Server 1 and server 2 follow each other
|
||||
await doubleFollow(servers[0], servers[1])
|
||||
|
||||
// Upload a video on pod 2
|
||||
// Upload a video on server 2
|
||||
const videoAttributes = {
|
||||
name: 'my super name for pod 2',
|
||||
description: 'my super description for pod 2'
|
||||
name: 'my super name for server 2',
|
||||
description: 'my super description for server 2'
|
||||
}
|
||||
await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
|
||||
|
||||
// Wait videos propagation
|
||||
await wait(22000)
|
||||
await wait(25000)
|
||||
|
||||
const res = await getVideosList(servers[0].url)
|
||||
const videos = res.body.data
|
||||
|
||||
expect(videos.length).to.equal(1)
|
||||
|
||||
servers[0].remoteVideo = videos.find(video => video.name === 'my super name for pod 2')
|
||||
servers[0].remoteVideo = videos.find(video => video.name === 'my super name for server 2')
|
||||
})
|
||||
|
||||
it('Should blacklist a remote video on pod 1', async function () {
|
||||
it('Should blacklist a remote video on server 1', async function () {
|
||||
await addVideoToBlacklist(servers[0].url, servers[0].accessToken, servers[0].remoteVideo.id)
|
||||
})
|
||||
|
||||
it('Should not have the video blacklisted in videos list on pod 1', async function () {
|
||||
it('Should not have the video blacklisted in videos list on server 1', async function () {
|
||||
const res = await getVideosList(servers[0].url)
|
||||
|
||||
expect(res.body.total).to.equal(0)
|
||||
|
@ -63,7 +63,7 @@ describe('Test video blacklists', function () {
|
|||
expect(res.body.data.length).to.equal(0)
|
||||
})
|
||||
|
||||
it('Should not have the video blacklisted in videos search on pod 1', async function () {
|
||||
it('Should not have the video blacklisted in videos search on server 1', async function () {
|
||||
const res = await searchVideo(servers[0].url, 'name')
|
||||
|
||||
expect(res.body.total).to.equal(0)
|
||||
|
@ -71,7 +71,7 @@ describe('Test video blacklists', function () {
|
|||
expect(res.body.data.length).to.equal(0)
|
||||
})
|
||||
|
||||
it('Should have the blacklisted video in videos list on pod 2', async function () {
|
||||
it('Should have the blacklisted video in videos list on server 2', async function () {
|
||||
const res = await getVideosList(servers[1].url)
|
||||
|
||||
expect(res.body.total).to.equal(1)
|
||||
|
@ -79,7 +79,7 @@ describe('Test video blacklists', function () {
|
|||
expect(res.body.data.length).to.equal(1)
|
||||
})
|
||||
|
||||
it('Should have the video blacklisted in videos search on pod 2', async function () {
|
||||
it('Should have the video blacklisted in videos search on server 2', async function () {
|
||||
const res = await searchVideo(servers[1].url, 'name')
|
||||
|
||||
expect(res.body.total).to.equal(1)
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
getMyUserInformation,
|
||||
getVideoChannelsList,
|
||||
addVideoChannel,
|
||||
getAuthorVideoChannelsList,
|
||||
getAccountVideoChannelsList,
|
||||
updateVideoChannel,
|
||||
deleteVideoChannel,
|
||||
getVideoChannel
|
||||
|
@ -64,8 +64,8 @@ describe('Test a video channels', function () {
|
|||
expect(videoChannels[1].description).to.equal('super video channel description')
|
||||
})
|
||||
|
||||
it('Should have two video channels when getting author channels', async () => {
|
||||
const res = await getAuthorVideoChannelsList(server.url, userInfo.account.uuid)
|
||||
it('Should have two video channels when getting account channels', async () => {
|
||||
const res = await getAccountVideoChannelsList(server.url, userInfo.account.uuid)
|
||||
|
||||
expect(res.body.total).to.equal(2)
|
||||
expect(res.body.data).to.be.an('array')
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
/* tslint:disable:no-unused-expression */
|
||||
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
|
||||
import 'mocha'
|
||||
import {
|
||||
flushAndRunMultipleServers,
|
||||
flushTests,
|
||||
getVideo,
|
||||
getVideoDescription,
|
||||
getVideosList,
|
||||
killallServers,
|
||||
makeFriends,
|
||||
ServerInfo,
|
||||
setAccessTokensToServers,
|
||||
updateVideo,
|
||||
uploadVideo,
|
||||
wait,
|
||||
getVideoDescription,
|
||||
updateVideo
|
||||
wait
|
||||
} from '../utils'
|
||||
import { doubleFollow } from '../utils/follows'
|
||||
|
||||
const expect = chai.expect
|
||||
|
||||
|
@ -24,10 +23,10 @@ describe('Test video description', function () {
|
|||
let servers: ServerInfo[] = []
|
||||
let videoUUID = ''
|
||||
let videoId: number
|
||||
let longDescription = 'my super description for pod 1'.repeat(50)
|
||||
let longDescription = 'my super description for server 1'.repeat(50)
|
||||
|
||||
before(async function () {
|
||||
this.timeout(10000)
|
||||
this.timeout(30000)
|
||||
|
||||
// Run servers
|
||||
servers = await flushAndRunMultipleServers(2)
|
||||
|
@ -35,19 +34,19 @@ describe('Test video description', function () {
|
|||
// Get the access tokens
|
||||
await setAccessTokensToServers(servers)
|
||||
|
||||
// Pod 1 makes friend with pod 2
|
||||
await makeFriends(servers[0].url, servers[0].accessToken)
|
||||
// Server 1 and server 2 follow each other
|
||||
await doubleFollow(servers[0], servers[1])
|
||||
})
|
||||
|
||||
it('Should upload video with long description', async function () {
|
||||
this.timeout(15000)
|
||||
this.timeout(30000)
|
||||
|
||||
const attributes = {
|
||||
description: longDescription
|
||||
}
|
||||
await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
|
||||
|
||||
await wait(11000)
|
||||
await wait(25000)
|
||||
|
||||
const res = await getVideosList(servers[0].url)
|
||||
|
||||
|
@ -55,20 +54,20 @@ describe('Test video description', function () {
|
|||
videoUUID = res.body.data[0].uuid
|
||||
})
|
||||
|
||||
it('Should have a truncated description on each pod', async function () {
|
||||
it('Should have a truncated description on each server', async function () {
|
||||
for (const server of servers) {
|
||||
const res = await getVideo(server.url, videoUUID)
|
||||
const video = res.body
|
||||
|
||||
// 30 characters * 6 -> 240 characters
|
||||
const truncatedDescription = 'my super description for pod 1'.repeat(8) +
|
||||
'my supe...'
|
||||
const truncatedDescription = 'my super description for server 1'.repeat(7) +
|
||||
'my super descrip...'
|
||||
|
||||
expect(video.description).to.equal(truncatedDescription)
|
||||
}
|
||||
})
|
||||
|
||||
it('Should fetch long description on each pod', async function () {
|
||||
it('Should fetch long description on each server', async function () {
|
||||
for (const server of servers) {
|
||||
const res = await getVideo(server.url, videoUUID)
|
||||
const video = res.body
|
||||
|
@ -79,17 +78,17 @@ describe('Test video description', function () {
|
|||
})
|
||||
|
||||
it('Should update with a short description', async function () {
|
||||
this.timeout(15000)
|
||||
this.timeout(30000)
|
||||
|
||||
const attributes = {
|
||||
description: 'short description'
|
||||
}
|
||||
await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes)
|
||||
|
||||
await wait(11000)
|
||||
await wait(25000)
|
||||
})
|
||||
|
||||
it('Should have a small description on each pod', async function () {
|
||||
it('Should have a small description on each server', async function () {
|
||||
for (const server of servers) {
|
||||
const res = await getVideo(server.url, videoUUID)
|
||||
const video = res.body
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/* tslint:disable:no-unused-expression */
|
||||
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
const expect = chai.expect
|
||||
|
||||
import {
|
||||
ServerInfo,
|
||||
flushTests,
|
||||
uploadVideo,
|
||||
makeFriends,
|
||||
getVideosList,
|
||||
wait,
|
||||
setAccessTokensToServers,
|
||||
flushAndRunMultipleServers,
|
||||
killallServers
|
||||
} from '../utils'
|
||||
import 'mocha'
|
||||
import { VideoPrivacy } from '../../../shared/models/videos/video-privacy.enum'
|
||||
import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../utils/videos'
|
||||
import { createUser } from '../utils/users'
|
||||
import {
|
||||
flushAndRunMultipleServers,
|
||||
flushTests,
|
||||
getVideosList,
|
||||
killallServers,
|
||||
ServerInfo,
|
||||
setAccessTokensToServers,
|
||||
uploadVideo,
|
||||
wait
|
||||
} from '../utils'
|
||||
import { doubleFollow } from '../utils/follows'
|
||||
import { getUserAccessToken } from '../utils/login'
|
||||
import { createUser } from '../utils/users'
|
||||
import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../utils/videos'
|
||||
|
||||
const expect = chai.expect
|
||||
|
||||
describe('Test video privacy', function () {
|
||||
let servers: ServerInfo[] = []
|
||||
|
@ -35,11 +35,11 @@ describe('Test video privacy', function () {
|
|||
// Get the access tokens
|
||||
await setAccessTokensToServers(servers)
|
||||
|
||||
// Pod 1 makes friend with pod 2
|
||||
await makeFriends(servers[0].url, servers[0].accessToken)
|
||||
// Server 1 and server 2 follow each other
|
||||
await doubleFollow(servers[0], servers[1])
|
||||
})
|
||||
|
||||
it('Should upload a private video on pod 1', async function () {
|
||||
it('Should upload a private video on server 1', async function () {
|
||||
this.timeout(15000)
|
||||
|
||||
const attributes = {
|
||||
|
@ -50,7 +50,7 @@ describe('Test video privacy', function () {
|
|||
await wait(11000)
|
||||
})
|
||||
|
||||
it('Should not have this private video on pod 2', async function () {
|
||||
it('Should not have this private video on server 2', async function () {
|
||||
const res = await getVideosList(servers[1].url)
|
||||
|
||||
expect(res.body.total).to.equal(0)
|
||||
|
@ -86,7 +86,7 @@ describe('Test video privacy', function () {
|
|||
await getVideoWithToken(servers[0].url, servers[0].accessToken, privateVideoUUID)
|
||||
})
|
||||
|
||||
it('Should upload a unlisted video on pod 2', async function () {
|
||||
it('Should upload a unlisted video on server 2', async function () {
|
||||
this.timeout(30000)
|
||||
|
||||
const attributes = {
|
||||
|
@ -98,7 +98,7 @@ describe('Test video privacy', function () {
|
|||
await wait(22000)
|
||||
})
|
||||
|
||||
it('Should not have this unlisted video listed on pod 1 and 2', async function () {
|
||||
it('Should not have this unlisted video listed on server 1 and 2', async function () {
|
||||
for (const server of servers) {
|
||||
const res = await getVideosList(server.url)
|
||||
|
||||
|
@ -124,7 +124,7 @@ describe('Test video privacy', function () {
|
|||
}
|
||||
})
|
||||
|
||||
it('Should update the private video to public on pod 1', async function () {
|
||||
it('Should update the private video to public on server 1', async function () {
|
||||
this.timeout(15000)
|
||||
|
||||
const attribute = {
|
||||
|
@ -137,7 +137,7 @@ describe('Test video privacy', function () {
|
|||
await wait(11000)
|
||||
})
|
||||
|
||||
it('Should not have this new unlisted video listed on pod 1 and 2', async function () {
|
||||
it('Should not have this new unlisted video listed on server 1 and 2', async function () {
|
||||
for (const server of servers) {
|
||||
const res = await getVideosList(server.url)
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ describe('Test video transcoding', function () {
|
|||
this.timeout(60000)
|
||||
|
||||
const videoAttributes = {
|
||||
name: 'my super name for pod 1',
|
||||
description: 'my super description for pod 1',
|
||||
name: 'my super name for server 1',
|
||||
description: 'my super description for server 1',
|
||||
fixture: 'video_short.webm'
|
||||
}
|
||||
await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
|
||||
|
@ -61,8 +61,8 @@ describe('Test video transcoding', function () {
|
|||
this.timeout(60000)
|
||||
|
||||
const videoAttributes = {
|
||||
name: 'my super name for pod 2',
|
||||
description: 'my super description for pod 2',
|
||||
name: 'my super name for server 2',
|
||||
description: 'my super description for server 2',
|
||||
fixture: 'video_short.webm'
|
||||
}
|
||||
await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
|
||||
|
|
|
@ -20,8 +20,8 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?:
|
|||
.expect('Content-Type', /json/)
|
||||
}
|
||||
|
||||
function getAuthorVideoChannelsList (url: string, authorId: number | string) {
|
||||
const path = '/api/v1/videos/authors/' + authorId + '/channels'
|
||||
function getAccountVideoChannelsList (url: string, accountId: number | string) {
|
||||
const path = '/api/v1/videos/accounts/' + accountId + '/channels'
|
||||
|
||||
return request(url)
|
||||
.get(path)
|
||||
|
@ -87,7 +87,7 @@ function getVideoChannel (url: string, channelId: number) {
|
|||
|
||||
export {
|
||||
getVideoChannelsList,
|
||||
getAuthorVideoChannelsList,
|
||||
getAccountVideoChannelsList,
|
||||
addVideoChannel,
|
||||
updateVideoChannel,
|
||||
deleteVideoChannel,
|
||||
|
|
Loading…
Reference in New Issue