import { JobState, Video } from '../../../../shared/models'
import { VideoPrivacy } from '../../../../shared/models/videos'
import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
-import { completeVideoCheck, getVideo, immutableAssign, reRunServer, unfollow, viewVideo } from '../../utils'
+
import {
+ cleanupTests,
+ completeVideoCheck,
flushAndRunMultipleServers,
+ getVideo,
getVideosList,
+ immutableAssign,
killallServers,
+ reRunServer,
ServerInfo,
setAccessTokensToServers,
+ unfollow,
+ updateVideo,
uploadVideo,
wait
-} from '../../utils/index'
-import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows'
-import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs'
+} from '../../../../shared/extra-utils'
+import { follow, getFollowersListPaginationAndSort } from '../../../../shared/extra-utils/server/follows'
+import { getJobsListPaginationAndSort, waitJobs } from '../../../../shared/extra-utils/server/jobs'
import {
addVideoCommentReply,
addVideoCommentThread,
getVideoCommentThreads,
getVideoThreadComments
-} from '../../utils/videos/video-comments'
+} from '../../../../shared/extra-utils/videos/video-comments'
const expect = chai.expect
privacy: VideoPrivacy.UNLISTED
})
- const checkAttributes = {
- name: 'my super name for server 1',
- category: 5,
- licence: 4,
- language: 'ja',
- nsfw: true,
- description: 'my super description for server 1',
- support: 'my super support text for server 1',
- account: {
- name: 'root',
- host: 'localhost:9001'
- },
- isLocal: false,
- duration: 10,
- tags: [ 'tag1p1', 'tag2p1' ],
- privacy: VideoPrivacy.PUBLIC,
- commentsEnabled: true,
- downloadingEnabled: true,
- channel: {
- name: 'root_channel',
- displayName: 'Main root channel',
- description: '',
- isLocal: false
- },
- fixture: 'video_short1.webm',
- files: [
- {
- resolution: 720,
- size: 572456
- }
- ]
- }
-
- const unlistedCheckAttributes = immutableAssign(checkAttributes, {
- privacy: VideoPrivacy.UNLISTED
- })
+ let checkAttributes: any
+ let unlistedCheckAttributes: any
before(async function () {
this.timeout(30000)
servers = await flushAndRunMultipleServers(3)
+ checkAttributes = {
+ name: 'my super name for server 1',
+ category: 5,
+ licence: 4,
+ language: 'ja',
+ nsfw: true,
+ description: 'my super description for server 1',
+ support: 'my super support text for server 1',
+ account: {
+ name: 'root',
+ host: 'localhost:' + servers[0].port
+ },
+ isLocal: false,
+ duration: 10,
+ tags: [ 'tag1p1', 'tag2p1' ],
+ privacy: VideoPrivacy.PUBLIC,
+ commentsEnabled: true,
+ downloadEnabled: true,
+ channel: {
+ name: 'root_channel',
+ displayName: 'Main root channel',
+ description: '',
+ isLocal: false
+ },
+ fixture: 'video_short1.webm',
+ files: [
+ {
+ resolution: 720,
+ size: 572456
+ }
+ ]
+ }
+ unlistedCheckAttributes = immutableAssign(checkAttributes, {
+ privacy: VideoPrivacy.UNLISTED
+ })
+
// Get the access tokens
await setAccessTokensToServers(servers)
})
const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 2, 'createdAt')
expect(res.body.data).to.be.an('array')
expect(res.body.data).to.have.lengthOf(1)
- expect(res.body.data[0].follower.host).to.equal('localhost:9003')
+ expect(res.body.data[0].follower.host).to.equal('localhost:' + servers[2].port)
})
it('Should not have pending/processing jobs anymore', async function () {
expect(res.body.data).to.have.lengthOf(2)
})
- it('Should send a view to server 3, and automatically fetch the video', async function () {
+ it('Should send an update to server 3, and automatically fetch the video', async function () {
this.timeout(15000)
const res1 = await getVideosList(servers[2].url)
expect(res1.body.data).to.be.an('array')
expect(res1.body.data).to.have.lengthOf(11)
- await viewVideo(servers[0].url, missedVideo1.uuid)
- await viewVideo(servers[0].url, unlistedVideo.uuid)
+ await updateVideo(servers[0].url, servers[0].accessToken, missedVideo1.uuid, { })
+ await updateVideo(servers[0].url, servers[0].accessToken, unlistedVideo.uuid, { })
await waitJobs(servers)
})
after(async function () {
- killallServers(servers)
+ await cleanupTests(servers)
})
})