aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-17 10:55:40 +0200
committerChocobozzz <me@florianbigard.com>2020-06-17 11:42:50 +0200
commitfaa9d434b4d681837ff2a87603337c2623419669 (patch)
tree1f3c798dd6fd5f2dcbb019978f063f448c019974 /server/tests/api
parent982f2fc9b42537ca40ff29bf62c1ca3692d4b587 (diff)
downloadPeerTube-faa9d434b4d681837ff2a87603337c2623419669.tar.gz
PeerTube-faa9d434b4d681837ff2a87603337c2623419669.tar.zst
PeerTube-faa9d434b4d681837ff2a87603337c2623419669.zip
Update server dependencies
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/users.ts7
-rw-r--r--server/tests/api/check-params/video-abuses.ts14
-rw-r--r--server/tests/api/check-params/video-imports.ts3
-rw-r--r--server/tests/api/check-params/video-playlists.ts3
-rw-r--r--server/tests/api/ci-2.sh2
-rw-r--r--server/tests/api/ci-4.sh2
-rw-r--r--server/tests/api/notifications/comments-notifications.ts22
7 files changed, 13 insertions, 40 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 472fbda43..74f0a2d3f 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -55,8 +55,6 @@ describe('Test users API validators', function () {
55 let moderatorAccessToken = '' 55 let moderatorAccessToken = ''
56 let emailPort: number 56 let emailPort: number
57 let overrideConfig: Object 57 let overrideConfig: Object
58 // eslint-disable-next-line @typescript-eslint/no-unused-vars
59 let channelId: number
60 58
61 // --------------------------------------------------------------- 59 // ---------------------------------------------------------------
62 60
@@ -130,11 +128,6 @@ describe('Test users API validators', function () {
130 } 128 }
131 129
132 { 130 {
133 const res = await getMyUserInformation(server.url, server.accessToken)
134 channelId = res.body.videoChannels[0].id
135 }
136
137 {
138 const res = await uploadVideo(server.url, server.accessToken, {}) 131 const res = await uploadVideo(server.url, server.accessToken, {})
139 videoId = res.body.video.id 132 videoId = res.body.video.id
140 } 133 }
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts
index e643cb95e..a3fe00ffb 100644
--- a/server/tests/api/check-params/video-abuses.ts
+++ b/server/tests/api/check-params/video-abuses.ts
@@ -141,13 +141,6 @@ describe('Test video abuses API validators', function () {
141 }) 141 })
142 142
143 describe('When updating a video abuse', function () { 143 describe('When updating a video abuse', function () {
144 const basePath = '/api/v1/videos/'
145 // eslint-disable-next-line @typescript-eslint/no-unused-vars
146 let path: string
147
148 before(() => {
149 path = basePath + server.video.id + '/abuse/' + videoAbuseId
150 })
151 144
152 it('Should fail with a non authenticated user', async function () { 145 it('Should fail with a non authenticated user', async function () {
153 await updateVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, {}, 401) 146 await updateVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, {}, 401)
@@ -179,13 +172,6 @@ describe('Test video abuses API validators', function () {
179 }) 172 })
180 173
181 describe('When deleting a video abuse', function () { 174 describe('When deleting a video abuse', function () {
182 const basePath = '/api/v1/videos/'
183 // eslint-disable-next-line @typescript-eslint/no-unused-vars
184 let path: string
185
186 before(() => {
187 path = basePath + server.video.id + '/abuse/' + videoAbuseId
188 })
189 175
190 it('Should fail with a non authenticated user', async function () { 176 it('Should fail with a non authenticated user', async function () {
191 await deleteVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, 401) 177 await deleteVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, 401)
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index dbea39c48..3759e47c4 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -29,8 +29,6 @@ describe('Test video imports API validator', function () {
29 const path = '/api/v1/videos/imports' 29 const path = '/api/v1/videos/imports'
30 let server: ServerInfo 30 let server: ServerInfo
31 let userAccessToken = '' 31 let userAccessToken = ''
32 // eslint-disable-next-line @typescript-eslint/no-unused-vars
33 let accountName: string
34 let channelId: number 32 let channelId: number
35 33
36 // --------------------------------------------------------------- 34 // ---------------------------------------------------------------
@@ -50,7 +48,6 @@ describe('Test video imports API validator', function () {
50 { 48 {
51 const res = await getMyUserInformation(server.url, server.accessToken) 49 const res = await getMyUserInformation(server.url, server.accessToken)
52 channelId = res.body.videoChannels[0].id 50 channelId = res.body.videoChannels[0].id
53 accountName = res.body.account.name + '@' + res.body.account.host
54 } 51 }
55 }) 52 })
56 53
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 0410e737a..46ec00d46 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -36,8 +36,6 @@ describe('Test video playlists API validator', function () {
36 let privatePlaylistUUID: string 36 let privatePlaylistUUID: string
37 let watchLaterPlaylistId: number 37 let watchLaterPlaylistId: number
38 let videoId: number 38 let videoId: number
39 // eslint-disable-next-line @typescript-eslint/no-unused-vars
40 let videoId2: number
41 let playlistElementId: number 39 let playlistElementId: number
42 40
43 // --------------------------------------------------------------- 41 // ---------------------------------------------------------------
@@ -52,7 +50,6 @@ describe('Test video playlists API validator', function () {
52 50
53 userAccessToken = await generateUserAccessToken(server, 'user1') 51 userAccessToken = await generateUserAccessToken(server, 'user1')
54 videoId = (await uploadVideoAndGetId({ server, videoName: 'video 1' })).id 52 videoId = (await uploadVideoAndGetId({ server, videoName: 'video 1' })).id
55 videoId2 = (await uploadVideoAndGetId({ server, videoName: 'video 2' })).id
56 53
57 { 54 {
58 const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, VideoPlaylistType.WATCH_LATER) 55 const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, VideoPlaylistType.WATCH_LATER)
diff --git a/server/tests/api/ci-2.sh b/server/tests/api/ci-2.sh
index 52c839d12..016df1cfc 100644
--- a/server/tests/api/ci-2.sh
+++ b/server/tests/api/ci-2.sh
@@ -5,6 +5,6 @@ set -eu
5serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo) 5serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo)
6usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo) 6usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo)
7 7
8MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit \ 8MOCHA_PARALLEL=true npm run mocha -- --parallel --jobs $1 --timeout 30000 --exit \
9 --require ts-node/register --require tsconfig-paths/register --bail \ 9 --require ts-node/register --require tsconfig-paths/register --bail \
10 $serverFiles $usersFiles 10 $serverFiles $usersFiles
diff --git a/server/tests/api/ci-4.sh b/server/tests/api/ci-4.sh
index 22785cf33..7d83cbdfc 100644
--- a/server/tests/api/ci-4.sh
+++ b/server/tests/api/ci-4.sh
@@ -5,6 +5,6 @@ set -eu
5redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo) 5redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo)
6activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo) 6activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo)
7 7
8MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit \ 8MOCHA_PARALLEL=true npm run mocha -- --parallel --jobs $1 --timeout 30000 --exit \
9 --require ts-node/register --require tsconfig-paths/register --bail \ 9 --require ts-node/register --require tsconfig-paths/register --bail \
10 $redundancyFiles $activitypubFiles 10 $redundancyFiles $activitypubFiles
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts
index cd3ed2f70..dfe846cc4 100644
--- a/server/tests/api/notifications/comments-notifications.ts
+++ b/server/tests/api/notifications/comments-notifications.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, getVideoCommentThreads, getVideoThreadComments, updateMyUser, wait } from '../../../../shared/extra-utils' 5import { cleanupTests, getVideoCommentThreads, getVideoThreadComments, updateMyUser } from '../../../../shared/extra-utils'
6import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index' 6import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index'
7import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' 7import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'
8import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 8import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
@@ -56,7 +56,7 @@ describe('Test comments notifications', function () {
56 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') 56 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment')
57 const commentId = resComment.body.comment.id 57 const commentId = resComment.body.comment.id
58 58
59 await wait(500) 59 await waitJobs(servers)
60 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') 60 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence')
61 }) 61 })
62 62
@@ -69,7 +69,7 @@ describe('Test comments notifications', function () {
69 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, 'comment') 69 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, 'comment')
70 const commentId = resComment.body.comment.id 70 const commentId = resComment.body.comment.id
71 71
72 await wait(500) 72 await waitJobs(servers)
73 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') 73 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence')
74 }) 74 })
75 75
@@ -84,7 +84,7 @@ describe('Test comments notifications', function () {
84 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') 84 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment')
85 const commentId = resComment.body.comment.id 85 const commentId = resComment.body.comment.id
86 86
87 await wait(500) 87 await waitJobs(servers)
88 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') 88 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence')
89 89
90 await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root') 90 await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root')
@@ -99,7 +99,7 @@ describe('Test comments notifications', function () {
99 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') 99 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment')
100 const commentId = resComment.body.comment.id 100 const commentId = resComment.body.comment.id
101 101
102 await wait(500) 102 await waitJobs(servers)
103 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence') 103 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence')
104 }) 104 })
105 105
@@ -134,7 +134,7 @@ describe('Test comments notifications', function () {
134 const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'reply') 134 const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'reply')
135 const commentId = resComment.body.comment.id 135 const commentId = resComment.body.comment.id
136 136
137 await wait(500) 137 await waitJobs(servers)
138 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence') 138 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence')
139 }) 139 })
140 140
@@ -200,7 +200,7 @@ describe('Test comments notifications', function () {
200 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello') 200 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello')
201 const commentId = resComment.body.comment.id 201 const commentId = resComment.body.comment.id
202 202
203 await wait(500) 203 await waitJobs(servers)
204 await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') 204 await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')
205 }) 205 })
206 206
@@ -213,7 +213,7 @@ describe('Test comments notifications', function () {
213 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, '@user_1 hello') 213 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, '@user_1 hello')
214 const commentId = resComment.body.comment.id 214 const commentId = resComment.body.comment.id
215 215
216 await wait(500) 216 await waitJobs(servers)
217 await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') 217 await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')
218 }) 218 })
219 219
@@ -228,7 +228,7 @@ describe('Test comments notifications', function () {
228 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello') 228 const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello')
229 const commentId = resComment.body.comment.id 229 const commentId = resComment.body.comment.id
230 230
231 await wait(500) 231 await waitJobs(servers)
232 await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') 232 await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')
233 233
234 await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root') 234 await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root')
@@ -257,13 +257,13 @@ describe('Test comments notifications', function () {
257 const resThread = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello 1') 257 const resThread = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello 1')
258 const threadId = resThread.body.comment.id 258 const threadId = resThread.body.comment.id
259 259
260 await wait(500) 260 await waitJobs(servers)
261 await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root name', 'presence') 261 await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root name', 'presence')
262 262
263 const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'hello 2 @user_1') 263 const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'hello 2 @user_1')
264 const commentId = resComment.body.comment.id 264 const commentId = resComment.body.comment.id
265 265
266 await wait(500) 266 await waitJobs(servers)
267 await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root name', 'presence') 267 await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root name', 'presence')
268 }) 268 })
269 269