diff options
-rw-r--r-- | server/controllers/api/server/follows.ts | 4 | ||||
-rw-r--r-- | server/initializers/constants.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-accept.ts | 8 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-create.ts | 4 | ||||
-rw-r--r-- | server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts | 1 | ||||
-rw-r--r-- | server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts | 4 | ||||
-rw-r--r-- | server/models/activitypub/actor.ts | 4 | ||||
-rw-r--r-- | server/tests/api/index-slow.ts | 1 | ||||
-rw-r--r-- | server/tests/api/server/handle-down.ts | 136 | ||||
-rw-r--r-- | server/tests/api/videos/video-channels.ts | 16 | ||||
-rw-r--r-- | server/tests/utils/server/servers.ts | 10 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 3 |
12 files changed, 161 insertions, 34 deletions
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index c87107197..b93d8a816 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts | |||
@@ -124,9 +124,7 @@ function follow (fromActor: ActorModel, targetActor: ActorModel) { | |||
124 | actorFollow.ActorFollower = fromActor | 124 | actorFollow.ActorFollower = fromActor |
125 | 125 | ||
126 | // Send a notification to remote server | 126 | // Send a notification to remote server |
127 | if (actorFollow.state === 'pending') { | 127 | await sendFollow(actorFollow, t) |
128 | await sendFollow(actorFollow, t) | ||
129 | } | ||
130 | }) | 128 | }) |
131 | } | 129 | } |
132 | 130 | ||
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 0c139912c..a3c128d1f 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -283,7 +283,7 @@ const ACTIVITY_PUB = { | |||
283 | MAGNET: [ 'application/x-bittorrent;x-scheme-handler/magnet' ] | 283 | MAGNET: [ 'application/x-bittorrent;x-scheme-handler/magnet' ] |
284 | }, | 284 | }, |
285 | MAX_RECURSION_COMMENTS: 100, | 285 | MAX_RECURSION_COMMENTS: 100, |
286 | ACTOR_REFRESH_INTERVAL: 3600 * 24 // 1 day | 286 | ACTOR_REFRESH_INTERVAL: 3600 * 24 * 1000 // 1 day |
287 | } | 287 | } |
288 | 288 | ||
289 | const ACTIVITY_PUB_ACTOR_TYPES: { [ id: string ]: ActivityPubActorType } = { | 289 | const ACTIVITY_PUB_ACTOR_TYPES: { [ id: string ]: ActivityPubActorType } = { |
@@ -355,7 +355,7 @@ if (isTestInstance() === true) { | |||
355 | REMOTE_SCHEME.WS = 'ws' | 355 | REMOTE_SCHEME.WS = 'ws' |
356 | STATIC_MAX_AGE = '0' | 356 | STATIC_MAX_AGE = '0' |
357 | ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2 | 357 | ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2 |
358 | ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 60 // 1 minute | 358 | ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 10 * 1000 // 10 seconds |
359 | CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB | 359 | CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB |
360 | SCHEDULER_INTERVAL = 10000 | 360 | SCHEDULER_INTERVAL = 10000 |
361 | } | 361 | } |
diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts index b9d906ec9..551f09ea7 100644 --- a/server/lib/activitypub/process/process-accept.ts +++ b/server/lib/activitypub/process/process-accept.ts | |||
@@ -23,7 +23,9 @@ async function processAccept (actor: ActorModel, targetActor: ActorModel) { | |||
23 | const follow = await ActorFollowModel.loadByActorAndTarget(actor.id, targetActor.id) | 23 | const follow = await ActorFollowModel.loadByActorAndTarget(actor.id, targetActor.id) |
24 | if (!follow) throw new Error('Cannot find associated follow.') | 24 | if (!follow) throw new Error('Cannot find associated follow.') |
25 | 25 | ||
26 | follow.set('state', 'accepted') | 26 | if (follow.state !== 'accepted') { |
27 | await follow.save() | 27 | follow.set('state', 'accepted') |
28 | await addFetchOutboxJob(targetActor, undefined) | 28 | await follow.save() |
29 | await addFetchOutboxJob(targetActor, undefined) | ||
30 | } | ||
29 | } | 31 | } |
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 08d61996a..442cd5c0b 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts | |||
@@ -147,8 +147,8 @@ async function processCreateView (byActor: ActorModel, activity: ActivityCreate) | |||
147 | 147 | ||
148 | const { video } = await getOrCreateAccountAndVideoAndChannel(view.object) | 148 | const { video } = await getOrCreateAccountAndVideoAndChannel(view.object) |
149 | 149 | ||
150 | const account = await ActorModel.loadByUrl(view.actor) | 150 | const actor = await ActorModel.loadByUrl(view.actor) |
151 | if (!account) throw new Error('Unknown account ' + view.actor) | 151 | if (!actor) throw new Error('Unknown actor ' + view.actor) |
152 | 152 | ||
153 | await video.increment('views') | 153 | await video.increment('views') |
154 | 154 | ||
diff --git a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts index 884ede5a3..10423a7df 100644 --- a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts +++ b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler.ts | |||
@@ -4,7 +4,6 @@ import { logger } from '../../../helpers/logger' | |||
4 | import { getServerActor } from '../../../helpers/utils' | 4 | import { getServerActor } from '../../../helpers/utils' |
5 | import { ACTIVITY_PUB } from '../../../initializers' | 5 | import { ACTIVITY_PUB } from '../../../initializers' |
6 | import { ActorModel } from '../../../models/activitypub/actor' | 6 | import { ActorModel } from '../../../models/activitypub/actor' |
7 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | ||
8 | import { JobHandler, JobScheduler } from '../job-scheduler' | 7 | import { JobHandler, JobScheduler } from '../job-scheduler' |
9 | 8 | ||
10 | import * as activitypubHttpBroadcastHandler from './activitypub-http-broadcast-handler' | 9 | import * as activitypubHttpBroadcastHandler from './activitypub-http-broadcast-handler' |
diff --git a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts index e02bd698e..deedf8402 100644 --- a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts +++ b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts | |||
@@ -19,11 +19,11 @@ async function process (payload: ActivityPubHttpPayload, jobId: number) { | |||
19 | 19 | ||
20 | try { | 20 | try { |
21 | await doRequest(options) | 21 | await doRequest(options) |
22 | await ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined) | 22 | ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined) |
23 | } catch (err) { | 23 | } catch (err) { |
24 | const isRetryingLater = await maybeRetryRequestLater(err, payload, uri) | 24 | const isRetryingLater = await maybeRetryRequestLater(err, payload, uri) |
25 | if (isRetryingLater === false) { | 25 | if (isRetryingLater === false) { |
26 | await ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined) | 26 | ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined) |
27 | } | 27 | } |
28 | 28 | ||
29 | throw err | 29 | throw err |
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index 912d8d748..6c74aa61b 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -41,11 +41,11 @@ enum ScopeNames { | |||
41 | [ScopeNames.FULL]: { | 41 | [ScopeNames.FULL]: { |
42 | include: [ | 42 | include: [ |
43 | { | 43 | { |
44 | model: () => AccountModel, | 44 | model: () => AccountModel.unscoped(), |
45 | required: false | 45 | required: false |
46 | }, | 46 | }, |
47 | { | 47 | { |
48 | model: () => VideoChannelModel, | 48 | model: () => VideoChannelModel.unscoped(), |
49 | required: false | 49 | required: false |
50 | }, | 50 | }, |
51 | { | 51 | { |
diff --git a/server/tests/api/index-slow.ts b/server/tests/api/index-slow.ts index fe86fc018..0082bcb56 100644 --- a/server/tests/api/index-slow.ts +++ b/server/tests/api/index-slow.ts | |||
@@ -6,3 +6,4 @@ import './server/follows' | |||
6 | import './server/jobs' | 6 | import './server/jobs' |
7 | import './videos/video-comments' | 7 | import './videos/video-comments' |
8 | import './users/users-multiple-servers' | 8 | import './users/users-multiple-servers' |
9 | import './server/handle-down' | ||
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index f8ba8bd66..cc1ff9a9f 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -3,7 +3,8 @@ | |||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { VideoPrivacy } from '../../../../shared/models/videos' | 5 | import { VideoPrivacy } from '../../../../shared/models/videos' |
6 | import { completeVideoCheck, runServer, viewVideo } from '../../utils' | 6 | import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' |
7 | import { completeVideoCheck, getVideo, immutableAssign, reRunServer, viewVideo } from '../../utils' | ||
7 | 8 | ||
8 | import { | 9 | import { |
9 | flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, | 10 | flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, |
@@ -11,11 +12,20 @@ import { | |||
11 | } from '../../utils/index' | 12 | } from '../../utils/index' |
12 | import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' | 13 | import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' |
13 | import { getJobsListPaginationAndSort } from '../../utils/server/jobs' | 14 | import { getJobsListPaginationAndSort } from '../../utils/server/jobs' |
15 | import { | ||
16 | addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, | ||
17 | getVideoThreadComments | ||
18 | } from '../../utils/videos/video-comments' | ||
14 | 19 | ||
15 | const expect = chai.expect | 20 | const expect = chai.expect |
16 | 21 | ||
17 | describe('Test handle downs', function () { | 22 | describe('Test handle downs', function () { |
18 | let servers: ServerInfo[] = [] | 23 | let servers: ServerInfo[] = [] |
24 | const videos = [] | ||
25 | let threadIdServer1: number | ||
26 | let threadIdServer2: number | ||
27 | let commentIdServer1: number | ||
28 | let commentIdServer2: number | ||
19 | 29 | ||
20 | const videoAttributes = { | 30 | const videoAttributes = { |
21 | name: 'my super name for server 1', | 31 | name: 'my super name for server 1', |
@@ -23,11 +33,16 @@ describe('Test handle downs', function () { | |||
23 | licence: 4, | 33 | licence: 4, |
24 | language: 9, | 34 | language: 9, |
25 | nsfw: true, | 35 | nsfw: true, |
36 | privacy: VideoPrivacy.PUBLIC, | ||
26 | description: 'my super description for server 1', | 37 | description: 'my super description for server 1', |
27 | tags: [ 'tag1p1', 'tag2p1' ], | 38 | tags: [ 'tag1p1', 'tag2p1' ], |
28 | fixture: 'video_short1.webm' | 39 | fixture: 'video_short1.webm' |
29 | } | 40 | } |
30 | 41 | ||
42 | const unlistedVideoAttributes = immutableAssign(videoAttributes, { | ||
43 | privacy: VideoPrivacy.UNLISTED | ||
44 | }) | ||
45 | |||
31 | const checkAttributes = { | 46 | const checkAttributes = { |
32 | name: 'my super name for server 1', | 47 | name: 'my super name for server 1', |
33 | category: 5, | 48 | category: 5, |
@@ -56,6 +71,10 @@ describe('Test handle downs', function () { | |||
56 | ] | 71 | ] |
57 | } | 72 | } |
58 | 73 | ||
74 | const unlistedCheckAttributes = immutableAssign(checkAttributes, { | ||
75 | privacy: VideoPrivacy.UNLISTED | ||
76 | }) | ||
77 | |||
59 | before(async function () { | 78 | before(async function () { |
60 | this.timeout(20000) | 79 | this.timeout(20000) |
61 | 80 | ||
@@ -85,9 +104,27 @@ describe('Test handle downs', function () { | |||
85 | // Kill server 1 | 104 | // Kill server 1 |
86 | killallServers([ servers[1] ]) | 105 | killallServers([ servers[1] ]) |
87 | 106 | ||
107 | let resVideo = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, unlistedVideoAttributes) | ||
108 | videos.push(resVideo.body.video) | ||
109 | |||
88 | // Remove server 2 follower | 110 | // Remove server 2 follower |
89 | for (let i = 0; i < 10; i++) { | 111 | for (let i = 0; i < 10; i++) { |
90 | await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes) | 112 | resVideo = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes) |
113 | videos.push(resVideo.body.video) | ||
114 | } | ||
115 | |||
116 | // Add comments to video 2 | ||
117 | { | ||
118 | const text = 'thread 1' | ||
119 | let resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, videos[1].uuid, text) | ||
120 | let comment = resComment.body.comment | ||
121 | threadIdServer1 = comment.id | ||
122 | |||
123 | resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, videos[1].uuid, comment.id, 'comment 1-1') | ||
124 | comment = resComment.body.comment | ||
125 | |||
126 | resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, videos[1].uuid, comment.id, 'comment 1-2') | ||
127 | commentIdServer1 = resComment.body.comment.id | ||
91 | } | 128 | } |
92 | 129 | ||
93 | await wait(10000) | 130 | await wait(10000) |
@@ -108,7 +145,9 @@ describe('Test handle downs', function () { | |||
108 | }) | 145 | }) |
109 | 146 | ||
110 | it('Should follow server 1', async function () { | 147 | it('Should follow server 1', async function () { |
111 | servers[1] = await runServer(2) | 148 | this.timeout(15000) |
149 | |||
150 | await reRunServer(servers[1]) | ||
112 | 151 | ||
113 | await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken) | 152 | await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken) |
114 | 153 | ||
@@ -120,19 +159,98 @@ describe('Test handle downs', function () { | |||
120 | }) | 159 | }) |
121 | 160 | ||
122 | it('Should send a view to server 2, and automatically fetch the video', async function () { | 161 | it('Should send a view to server 2, and automatically fetch the video', async function () { |
123 | const resVideo = await getVideosList(servers[0].url) | 162 | this.timeout(15000) |
124 | const videoServer1 = resVideo.body.data[0] | ||
125 | 163 | ||
126 | await viewVideo(servers[0].url, videoServer1.uuid) | 164 | await viewVideo(servers[0].url, videos[0].uuid) |
127 | 165 | ||
128 | await wait(5000) | 166 | await wait(5000) |
129 | 167 | ||
130 | const res = await getVideosList(servers[1].url) | 168 | const res = await getVideosList(servers[1].url) |
131 | const videoServer2 = res.body.data.find(v => v.url === videoServer1.url) | 169 | expect(res.body.data).to.be.an('array') |
170 | // Video is unlisted | ||
171 | expect(res.body.data).to.have.lengthOf(1) | ||
172 | |||
173 | const resVideo = await getVideo(servers[1].url, videos[0].uuid) | ||
174 | expect(resVideo.body).not.to.be.undefined | ||
175 | |||
176 | await completeVideoCheck(servers[1].url, resVideo.body, unlistedCheckAttributes) | ||
177 | }) | ||
178 | |||
179 | it('Should send comments on a video to server 2, and automatically fetch the video', async function () { | ||
180 | this.timeout(25000) | ||
132 | 181 | ||
133 | expect(videoServer2).not.to.be.undefined | 182 | await addVideoCommentReply(servers[0].url, servers[0].accessToken, videos[1].uuid, commentIdServer1, 'comment 1-3') |
183 | |||
184 | await wait(5000) | ||
185 | |||
186 | const res = await getVideosList(servers[1].url) | ||
187 | expect(res.body.data).to.be.an('array') | ||
188 | expect(res.body.data).to.have.lengthOf(2) | ||
134 | 189 | ||
135 | await completeVideoCheck(servers[1].url, videoServer2, checkAttributes) | 190 | const resVideo = await getVideo(servers[1].url, videos[0].uuid) |
191 | expect(resVideo.body).not.to.be.undefined | ||
192 | |||
193 | await completeVideoCheck(servers[1].url, resVideo.body, unlistedCheckAttributes) | ||
194 | |||
195 | { | ||
196 | let resComment = await getVideoCommentThreads(servers[1].url, videos[1].uuid, 0, 5) | ||
197 | expect(resComment.body.data).to.be.an('array') | ||
198 | expect(resComment.body.data).to.have.lengthOf(1) | ||
199 | |||
200 | threadIdServer2 = resComment.body.data[0].id | ||
201 | |||
202 | resComment = await getVideoThreadComments(servers[1].url, videos[1].uuid, threadIdServer2) | ||
203 | |||
204 | const tree: VideoCommentThreadTree = resComment.body | ||
205 | expect(tree.comment.text).equal('thread 1') | ||
206 | expect(tree.children).to.have.lengthOf(1) | ||
207 | |||
208 | const firstChild = tree.children[0] | ||
209 | expect(firstChild.comment.text).to.equal('comment 1-1') | ||
210 | expect(firstChild.children).to.have.lengthOf(1) | ||
211 | |||
212 | const childOfFirstChild = firstChild.children[0] | ||
213 | expect(childOfFirstChild.comment.text).to.equal('comment 1-2') | ||
214 | expect(childOfFirstChild.children).to.have.lengthOf(1) | ||
215 | |||
216 | const childOfChildFirstChild = childOfFirstChild.children[0] | ||
217 | expect(childOfChildFirstChild.comment.text).to.equal('comment 1-3') | ||
218 | expect(childOfChildFirstChild.children).to.have.lengthOf(0) | ||
219 | |||
220 | commentIdServer2 = childOfChildFirstChild.comment.id | ||
221 | } | ||
222 | }) | ||
223 | |||
224 | it('Should correctly reply to the comment', async function () { | ||
225 | this.timeout(15000) | ||
226 | |||
227 | await addVideoCommentReply(servers[1].url, servers[1].accessToken, videos[1].uuid, commentIdServer2, 'comment 1-4') | ||
228 | |||
229 | await wait(5000) | ||
230 | |||
231 | { | ||
232 | const resComment = await getVideoThreadComments(servers[0].url, videos[1].uuid, threadIdServer1) | ||
233 | |||
234 | const tree: VideoCommentThreadTree = resComment.body | ||
235 | expect(tree.comment.text).equal('thread 1') | ||
236 | expect(tree.children).to.have.lengthOf(1) | ||
237 | |||
238 | const firstChild = tree.children[0] | ||
239 | expect(firstChild.comment.text).to.equal('comment 1-1') | ||
240 | expect(firstChild.children).to.have.lengthOf(1) | ||
241 | |||
242 | const childOfFirstChild = firstChild.children[0] | ||
243 | expect(childOfFirstChild.comment.text).to.equal('comment 1-2') | ||
244 | expect(childOfFirstChild.children).to.have.lengthOf(1) | ||
245 | |||
246 | const childOfChildFirstChild = childOfFirstChild.children[0] | ||
247 | expect(childOfChildFirstChild.comment.text).to.equal('comment 1-3') | ||
248 | expect(childOfChildFirstChild.children).to.have.lengthOf(1) | ||
249 | |||
250 | const childOfChildOfChildOfFirstChild = childOfChildFirstChild.children[0] | ||
251 | expect(childOfChildOfChildOfFirstChild.comment.text).to.equal('comment 1-4') | ||
252 | expect(childOfChildOfChildOfFirstChild.children).to.have.lengthOf(0) | ||
253 | } | ||
136 | }) | 254 | }) |
137 | 255 | ||
138 | after(async function () { | 256 | after(async function () { |
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 454a96da6..8d33c6025 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -59,8 +59,8 @@ describe('Test a video channels', function () { | |||
59 | expect(userInfo.videoChannels).to.have.lengthOf(2) | 59 | expect(userInfo.videoChannels).to.have.lengthOf(2) |
60 | 60 | ||
61 | const videoChannels = userInfo.videoChannels | 61 | const videoChannels = userInfo.videoChannels |
62 | expect(videoChannels[0].name).to.equal('Default root channel') | 62 | expect(videoChannels[0].displayName).to.equal('Default root channel') |
63 | expect(videoChannels[1].name).to.equal('second video channel') | 63 | expect(videoChannels[1].displayName).to.equal('second video channel') |
64 | expect(videoChannels[1].description).to.equal('super video channel description') | 64 | expect(videoChannels[1].description).to.equal('super video channel description') |
65 | }) | 65 | }) |
66 | 66 | ||
@@ -72,8 +72,8 @@ describe('Test a video channels', function () { | |||
72 | expect(res.body.data).to.have.lengthOf(2) | 72 | expect(res.body.data).to.have.lengthOf(2) |
73 | 73 | ||
74 | const videoChannels = res.body.data | 74 | const videoChannels = res.body.data |
75 | expect(videoChannels[0].name).to.equal('Default root channel') | 75 | expect(videoChannels[0].displayName).to.equal('Default root channel') |
76 | expect(videoChannels[1].name).to.equal('second video channel') | 76 | expect(videoChannels[1].displayName).to.equal('second video channel') |
77 | expect(videoChannels[1].description).to.equal('super video channel description') | 77 | expect(videoChannels[1].description).to.equal('super video channel description') |
78 | 78 | ||
79 | videoChannelId = videoChannels[1].id | 79 | videoChannelId = videoChannels[1].id |
@@ -85,7 +85,7 @@ describe('Test a video channels', function () { | |||
85 | expect(res.body.total).to.equal(2) | 85 | expect(res.body.total).to.equal(2) |
86 | expect(res.body.data).to.be.an('array') | 86 | expect(res.body.data).to.be.an('array') |
87 | expect(res.body.data).to.have.lengthOf(1) | 87 | expect(res.body.data).to.have.lengthOf(1) |
88 | expect(res.body.data[0].name).to.equal('Default root channel') | 88 | expect(res.body.data[0].displayName).to.equal('Default root channel') |
89 | }) | 89 | }) |
90 | 90 | ||
91 | it('Should update video channel', async () => { | 91 | it('Should update video channel', async () => { |
@@ -103,7 +103,7 @@ describe('Test a video channels', function () { | |||
103 | expect(res.body.total).to.equal(2) | 103 | expect(res.body.total).to.equal(2) |
104 | expect(res.body.data).to.be.an('array') | 104 | expect(res.body.data).to.be.an('array') |
105 | expect(res.body.data).to.have.lengthOf(1) | 105 | expect(res.body.data).to.have.lengthOf(1) |
106 | expect(res.body.data[0].name).to.equal('video channel updated') | 106 | expect(res.body.data[0].displayName).to.equal('video channel updated') |
107 | expect(res.body.data[0].description).to.equal('video channel description updated') | 107 | expect(res.body.data[0].description).to.equal('video channel description updated') |
108 | }) | 108 | }) |
109 | 109 | ||
@@ -111,7 +111,7 @@ describe('Test a video channels', function () { | |||
111 | const res = await getVideoChannel(server.url, videoChannelId) | 111 | const res = await getVideoChannel(server.url, videoChannelId) |
112 | 112 | ||
113 | const videoChannel = res.body | 113 | const videoChannel = res.body |
114 | expect(videoChannel.name).to.equal('video channel updated') | 114 | expect(videoChannel.displayName).to.equal('video channel updated') |
115 | expect(videoChannel.description).to.equal('video channel description updated') | 115 | expect(videoChannel.description).to.equal('video channel description updated') |
116 | }) | 116 | }) |
117 | 117 | ||
@@ -125,7 +125,7 @@ describe('Test a video channels', function () { | |||
125 | expect(res.body.total).to.equal(1) | 125 | expect(res.body.total).to.equal(1) |
126 | expect(res.body.data).to.be.an('array') | 126 | expect(res.body.data).to.be.an('array') |
127 | expect(res.body.data).to.have.lengthOf(1) | 127 | expect(res.body.data).to.have.lengthOf(1) |
128 | expect(res.body.data[0].name).to.equal('Default root channel') | 128 | expect(res.body.data[0].displayName).to.equal('Default root channel') |
129 | }) | 129 | }) |
130 | 130 | ||
131 | after(async function () { | 131 | after(async function () { |
diff --git a/server/tests/utils/server/servers.ts b/server/tests/utils/server/servers.ts index 4add2f69a..878efe91a 100644 --- a/server/tests/utils/server/servers.ts +++ b/server/tests/utils/server/servers.ts | |||
@@ -145,6 +145,13 @@ function runServer (serverNumber: number, configOverride?: Object) { | |||
145 | }) | 145 | }) |
146 | } | 146 | } |
147 | 147 | ||
148 | async function reRunServer (server: ServerInfo) { | ||
149 | const newServer = await runServer(server.serverNumber) | ||
150 | server.app = newServer.app | ||
151 | |||
152 | return server | ||
153 | } | ||
154 | |||
148 | function killallServers (servers: ServerInfo[]) { | 155 | function killallServers (servers: ServerInfo[]) { |
149 | for (const server of servers) { | 156 | for (const server of servers) { |
150 | process.kill(-server.app.pid) | 157 | process.kill(-server.app.pid) |
@@ -158,5 +165,6 @@ export { | |||
158 | flushAndRunMultipleServers, | 165 | flushAndRunMultipleServers, |
159 | flushTests, | 166 | flushTests, |
160 | runServer, | 167 | runServer, |
161 | killallServers | 168 | killallServers, |
169 | reRunServer | ||
162 | } | 170 | } |
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index c437c21b2..dc1327215 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -383,7 +383,8 @@ async function completeVideoCheck ( | |||
383 | expect(videoDetails.account.name).to.equal(attributes.account) | 383 | expect(videoDetails.account.name).to.equal(attributes.account) |
384 | expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled) | 384 | expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled) |
385 | 385 | ||
386 | expect(videoDetails.channel.name).to.equal(attributes.channel.name) | 386 | expect(videoDetails.channel.displayName).to.equal(attributes.channel.name) |
387 | expect(videoDetails.channel.name).to.have.lengthOf(36) | ||
387 | expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal) | 388 | expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal) |
388 | expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true | 389 | expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true |
389 | expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true | 390 | expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true |