aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-24 15:10:37 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:26:25 +0200
commit7c3b79768bd174b22154e8d2df0b1211e01ee56a (patch)
tree9e45c9302083f0438f7ea174f5fb7d6042be5712 /server/tests/api/check-params
parent913b1d71e630d5a959c763bf565a171b4dc61434 (diff)
downloadPeerTube-7c3b79768bd174b22154e8d2df0b1211e01ee56a.tar.gz
PeerTube-7c3b79768bd174b22154e8d2df0b1211e01ee56a.tar.zst
PeerTube-7c3b79768bd174b22154e8d2df0b1211e01ee56a.zip
Use test wrapper exit function
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/config.ts8
-rw-r--r--server/tests/api/check-params/contact-form.ts14
-rw-r--r--server/tests/api/check-params/debug.ts6
-rw-r--r--server/tests/api/check-params/follows.ts12
-rw-r--r--server/tests/api/check-params/jobs.ts7
-rw-r--r--server/tests/api/check-params/logs.ts7
-rw-r--r--server/tests/api/check-params/redundancy.ts13
-rw-r--r--server/tests/api/check-params/search.ts6
-rw-r--r--server/tests/api/check-params/services.ts25
-rw-r--r--server/tests/api/check-params/user-notifications.ts15
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts27
-rw-r--r--server/tests/api/check-params/users.ts8
-rw-r--r--server/tests/api/check-params/video-abuses.ts9
-rw-r--r--server/tests/api/check-params/video-blacklist.ts5
-rw-r--r--server/tests/api/check-params/video-captions.ts9
-rw-r--r--server/tests/api/check-params/video-channels.ts12
-rw-r--r--server/tests/api/check-params/video-comments.ts6
-rw-r--r--server/tests/api/check-params/video-imports.ts9
-rw-r--r--server/tests/api/check-params/video-playlists.ts12
-rw-r--r--server/tests/api/check-params/videos-filter.ts12
-rw-r--r--server/tests/api/check-params/videos-history.ts9
-rw-r--r--server/tests/api/check-params/videos.ts60
22 files changed, 152 insertions, 139 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index 3d80c629e..2a2ec606a 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -6,7 +6,7 @@ import { CustomConfig } from '../../../../shared/models/server/custom-config.mod
6 6
7import { 7import {
8 createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, flushAndRunServer, ServerInfo, 8 createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, flushAndRunServer, ServerInfo,
9 setAccessTokensToServers, userLogin, immutableAssign 9 setAccessTokensToServers, userLogin, immutableAssign, cleanupTests
10} from '../../../../shared/extra-utils' 10} from '../../../../shared/extra-utils'
11 11
12describe('Test config API validators', function () { 12describe('Test config API validators', function () {
@@ -181,7 +181,7 @@ describe('Test config API validators', function () {
181 }) 181 })
182 182
183 it('Should fail if email disabled and signup requires email verification', async function () { 183 it('Should fail if email disabled and signup requires email verification', async function () {
184 // opposite scenario - succcess when enable enabled - covered via tests/api/users/user-verification.ts 184 // opposite scenario - success when enable enabled - covered via tests/api/users/user-verification.ts
185 const newUpdateParams = immutableAssign(updateParams, { 185 const newUpdateParams = immutableAssign(updateParams, {
186 signup: { 186 signup: {
187 enabled: true, 187 enabled: true,
@@ -229,7 +229,7 @@ describe('Test config API validators', function () {
229 }) 229 })
230 }) 230 })
231 231
232 after(function () { 232 after(async function () {
233 killallServers([ server ]) 233 await cleanupTests([ server ])
234 }) 234 })
235}) 235})
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts
index 6c7781f13..55004020f 100644
--- a/server/tests/api/check-params/contact-form.ts
+++ b/server/tests/api/check-params/contact-form.ts
@@ -9,7 +9,7 @@ import {
9 reRunServer, 9 reRunServer,
10 flushAndRunServer, 10 flushAndRunServer,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers 12 setAccessTokensToServers, cleanupTests
13} from '../../../../shared/extra-utils' 13} from '../../../../shared/extra-utils'
14import { 14import {
15 checkBadCountPagination, 15 checkBadCountPagination,
@@ -28,13 +28,14 @@ describe('Test contact form API validators', function () {
28 fromEmail: 'toto@example.com', 28 fromEmail: 'toto@example.com',
29 body: 'Hello, how are you?' 29 body: 'Hello, how are you?'
30 } 30 }
31 let emailPort: number
31 32
32 // --------------------------------------------------------------- 33 // ---------------------------------------------------------------
33 34
34 before(async function () { 35 before(async function () {
35 this.timeout(60000) 36 this.timeout(60000)
36 37
37 await MockSmtpServer.Instance.collectEmails(emails) 38 emailPort = await MockSmtpServer.Instance.collectEmails(emails)
38 39
39 // Email is disabled 40 // Email is disabled
40 server = await flushAndRunServer(1) 41 server = await flushAndRunServer(1)
@@ -50,7 +51,7 @@ describe('Test contact form API validators', function () {
50 killallServers([ server ]) 51 killallServers([ server ])
51 52
52 // Contact form is disabled 53 // Contact form is disabled
53 await reRunServer(server, { smtp: { hostname: 'localhost' }, contact_form: { enabled: false } }) 54 await reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort }, contact_form: { enabled: false } })
54 await sendContactForm(immutableAssign(defaultBody, { url: server.url, expectedStatus: 409 })) 55 await sendContactForm(immutableAssign(defaultBody, { url: server.url, expectedStatus: 409 }))
55 }) 56 })
56 57
@@ -60,7 +61,7 @@ describe('Test contact form API validators', function () {
60 killallServers([ server ]) 61 killallServers([ server ])
61 62
62 // Email & contact form enabled 63 // Email & contact form enabled
63 await reRunServer(server, { smtp: { hostname: 'localhost' } }) 64 await reRunServer(server, { smtp: { hostname: 'localhost', port: emailPort } })
64 65
65 await sendContactForm(immutableAssign(defaultBody, { url: server.url, expectedStatus: 400, fromEmail: 'badEmail' })) 66 await sendContactForm(immutableAssign(defaultBody, { url: server.url, expectedStatus: 400, fromEmail: 'badEmail' }))
66 await sendContactForm(immutableAssign(defaultBody, { url: server.url, expectedStatus: 400, fromEmail: 'badEmail@' })) 67 await sendContactForm(immutableAssign(defaultBody, { url: server.url, expectedStatus: 400, fromEmail: 'badEmail@' }))
@@ -83,8 +84,9 @@ describe('Test contact form API validators', function () {
83 await sendContactForm(immutableAssign(defaultBody, { url: server.url })) 84 await sendContactForm(immutableAssign(defaultBody, { url: server.url }))
84 }) 85 })
85 86
86 after(function () { 87 after(async function () {
87 MockSmtpServer.Instance.kill() 88 MockSmtpServer.Instance.kill()
88 killallServers([ server ]) 89
90 // await cleanupTests([ server ])
89 }) 91 })
90}) 92})
diff --git a/server/tests/api/check-params/debug.ts b/server/tests/api/check-params/debug.ts
index dd00ed9e1..8dad26723 100644
--- a/server/tests/api/check-params/debug.ts
+++ b/server/tests/api/check-params/debug.ts
@@ -9,7 +9,7 @@ import {
9 flushAndRunServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 userLogin 12 userLogin, cleanupTests
13} from '../../../../shared/extra-utils' 13} from '../../../../shared/extra-utils'
14import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' 14import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
15 15
@@ -65,7 +65,7 @@ describe('Test debug API validators', function () {
65 }) 65 })
66 }) 66 })
67 67
68 after(function () { 68 after(async function () {
69 killallServers([ server ]) 69 await cleanupTests([ server ])
70 }) 70 })
71}) 71})
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts
index 02f47c2bb..2eb54cb0a 100644
--- a/server/tests/api/check-params/follows.ts
+++ b/server/tests/api/check-params/follows.ts
@@ -3,7 +3,13 @@
3import 'mocha' 3import 'mocha'
4 4
5import { 5import {
6 createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers, 6 cleanupTests,
7 createUser,
8 flushAndRunServer,
9 makeDeleteRequest,
10 makePostBodyRequest,
11 ServerInfo,
12 setAccessTokensToServers,
7 userLogin 13 userLogin
8} from '../../../../shared/extra-utils' 14} from '../../../../shared/extra-utils'
9import { 15import {
@@ -295,7 +301,7 @@ describe('Test server follows API validators', function () {
295 }) 301 })
296 }) 302 })
297 303
298 after(function () { 304 after(async function () {
299 killallServers([ server ]) 305 await cleanupTests([ server ])
300 }) 306 })
301}) 307})
diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts
index ec2be0b9f..c70139514 100644
--- a/server/tests/api/check-params/jobs.ts
+++ b/server/tests/api/check-params/jobs.ts
@@ -9,7 +9,8 @@ import {
9 flushAndRunServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 userLogin 12 userLogin,
13 cleanupTests
13} from '../../../../shared/extra-utils' 14} from '../../../../shared/extra-utils'
14import { 15import {
15 checkBadCountPagination, 16 checkBadCountPagination,
@@ -80,7 +81,7 @@ describe('Test jobs API validators', function () {
80 }) 81 })
81 }) 82 })
82 83
83 after(function () { 84 after(async function () {
84 killallServers([ server ]) 85 await cleanupTests([ server ])
85 }) 86 })
86}) 87})
diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts
index 46cb2392d..f9d96bcc0 100644
--- a/server/tests/api/check-params/logs.ts
+++ b/server/tests/api/check-params/logs.ts
@@ -9,7 +9,8 @@ import {
9 flushAndRunServer, 9 flushAndRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 userLogin 12 userLogin,
13 cleanupTests
13} from '../../../../shared/extra-utils' 14} from '../../../../shared/extra-utils'
14import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' 15import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
15 16
@@ -104,7 +105,7 @@ describe('Test logs API validators', function () {
104 }) 105 })
105 }) 106 })
106 107
107 after(function () { 108 after(async function () {
108 killallServers([ server ]) 109 await cleanupTests([ server ])
109 }) 110 })
110}) 111})
diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts
index 8f930fbbc..6471da840 100644
--- a/server/tests/api/check-params/redundancy.ts
+++ b/server/tests/api/check-params/redundancy.ts
@@ -3,6 +3,7 @@
3import 'mocha' 3import 'mocha'
4 4
5import { 5import {
6 cleanupTests,
6 createUser, 7 createUser,
7 doubleFollow, 8 doubleFollow,
8 flushAndRunMultipleServers, 9 flushAndRunMultipleServers,
@@ -43,7 +44,7 @@ describe('Test server redundancy API validators', function () {
43 it('Should fail with an invalid token', async function () { 44 it('Should fail with an invalid token', async function () {
44 await makePutBodyRequest({ 45 await makePutBodyRequest({
45 url: servers[0].url, 46 url: servers[0].url,
46 path: path + '/localhost:9002', 47 path: path + '/localhost:' + servers[1].port,
47 fields: { redundancyAllowed: true }, 48 fields: { redundancyAllowed: true },
48 token: 'fake_token', 49 token: 'fake_token',
49 statusCodeExpected: 401 50 statusCodeExpected: 401
@@ -53,7 +54,7 @@ describe('Test server redundancy API validators', function () {
53 it('Should fail if the user is not an administrator', async function () { 54 it('Should fail if the user is not an administrator', async function () {
54 await makePutBodyRequest({ 55 await makePutBodyRequest({
55 url: servers[0].url, 56 url: servers[0].url,
56 path: path + '/localhost:9002', 57 path: path + '/localhost:' + servers[1].port,
57 fields: { redundancyAllowed: true }, 58 fields: { redundancyAllowed: true },
58 token: userAccessToken, 59 token: userAccessToken,
59 statusCodeExpected: 403 60 statusCodeExpected: 403
@@ -73,7 +74,7 @@ describe('Test server redundancy API validators', function () {
73 it('Should fail without de redundancyAllowed param', async function () { 74 it('Should fail without de redundancyAllowed param', async function () {
74 await makePutBodyRequest({ 75 await makePutBodyRequest({
75 url: servers[0].url, 76 url: servers[0].url,
76 path: path + '/localhost:9002', 77 path: path + '/localhost:' + servers[1].port,
77 fields: { blabla: true }, 78 fields: { blabla: true },
78 token: servers[0].accessToken, 79 token: servers[0].accessToken,
79 statusCodeExpected: 400 80 statusCodeExpected: 400
@@ -83,7 +84,7 @@ describe('Test server redundancy API validators', function () {
83 it('Should succeed with the correct parameters', async function () { 84 it('Should succeed with the correct parameters', async function () {
84 await makePutBodyRequest({ 85 await makePutBodyRequest({
85 url: servers[0].url, 86 url: servers[0].url,
86 path: path + '/localhost:9002', 87 path: path + '/localhost:' + servers[1].port,
87 fields: { redundancyAllowed: true }, 88 fields: { redundancyAllowed: true },
88 token: servers[0].accessToken, 89 token: servers[0].accessToken,
89 statusCodeExpected: 204 90 statusCodeExpected: 204
@@ -91,7 +92,7 @@ describe('Test server redundancy API validators', function () {
91 }) 92 })
92 }) 93 })
93 94
94 after(function () { 95 after(async function () {
95 killallServers(servers) 96 await cleanupTests(servers)
96 }) 97 })
97}) 98})
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts
index 816719779..8ad9d98bf 100644
--- a/server/tests/api/check-params/search.ts
+++ b/server/tests/api/check-params/search.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { flushTests, immutableAssign, killallServers, makeGetRequest, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils' 5import { cleanupTests, flushAndRunServer, immutableAssign, makeGetRequest, ServerInfo } from '../../../../shared/extra-utils'
6import { 6import {
7 checkBadCountPagination, 7 checkBadCountPagination,
8 checkBadSortPagination, 8 checkBadSortPagination,
@@ -144,7 +144,7 @@ describe('Test videos API validator', function () {
144 }) 144 })
145 }) 145 })
146 146
147 after(function () { 147 after(async function () {
148 killallServers([ server ]) 148 await cleanupTests([ server ])
149 }) 149 })
150}) 150})
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts
index 33580ddb1..d15753aed 100644
--- a/server/tests/api/check-params/services.ts
+++ b/server/tests/api/check-params/services.ts
@@ -3,10 +3,9 @@
3import 'mocha' 3import 'mocha'
4 4
5import { 5import {
6 flushTests, 6 cleanupTests,
7 killallServers,
8 makeGetRequest,
9 flushAndRunServer, 7 flushAndRunServer,
8 makeGetRequest,
10 ServerInfo, 9 ServerInfo,
11 setAccessTokensToServers, 10 setAccessTokensToServers,
12 uploadVideo 11 uploadVideo
@@ -40,47 +39,47 @@ describe('Test services API validators', function () {
40 }) 39 })
41 40
42 it('Should fail with an invalid video id', async function () { 41 it('Should fail with an invalid video id', async function () {
43 const embedUrl = 'http://localhost:9001/videos/watch/blabla' 42 const embedUrl = `http://localhost:${server.port}/videos/watch/blabla`
44 await checkParamEmbed(server, embedUrl) 43 await checkParamEmbed(server, embedUrl)
45 }) 44 })
46 45
47 it('Should fail with an unknown video', async function () { 46 it('Should fail with an unknown video', async function () {
48 const embedUrl = 'http://localhost:9001/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c' 47 const embedUrl = `http://localhost:${server.port}/videos/watch/88fc0165-d1f0-4a35-a51a-3b47f668689c`
49 await checkParamEmbed(server, embedUrl, 404) 48 await checkParamEmbed(server, embedUrl, 404)
50 }) 49 })
51 50
52 it('Should fail with an invalid path', async function () { 51 it('Should fail with an invalid path', async function () {
53 const embedUrl = 'http://localhost:9001/videos/watchs/' + server.video.uuid 52 const embedUrl = `http://localhost:${server.port}/videos/watchs/${server.video.uuid}`
54 53
55 await checkParamEmbed(server, embedUrl) 54 await checkParamEmbed(server, embedUrl)
56 }) 55 })
57 56
58 it('Should fail with an invalid max height', async function () { 57 it('Should fail with an invalid max height', async function () {
59 const embedUrl = 'http://localhost:9001/videos/watch/' + server.video.uuid 58 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.video.uuid}`
60 59
61 await checkParamEmbed(server, embedUrl, 400, { maxheight: 'hello' }) 60 await checkParamEmbed(server, embedUrl, 400, { maxheight: 'hello' })
62 }) 61 })
63 62
64 it('Should fail with an invalid max width', async function () { 63 it('Should fail with an invalid max width', async function () {
65 const embedUrl = 'http://localhost:9001/videos/watch/' + server.video.uuid 64 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.video.uuid}`
66 65
67 await checkParamEmbed(server, embedUrl, 400, { maxwidth: 'hello' }) 66 await checkParamEmbed(server, embedUrl, 400, { maxwidth: 'hello' })
68 }) 67 })
69 68
70 it('Should fail with an invalid format', async function () { 69 it('Should fail with an invalid format', async function () {
71 const embedUrl = 'http://localhost:9001/videos/watch/' + server.video.uuid 70 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.video.uuid}`
72 71
73 await checkParamEmbed(server, embedUrl, 400, { format: 'blabla' }) 72 await checkParamEmbed(server, embedUrl, 400, { format: 'blabla' })
74 }) 73 })
75 74
76 it('Should fail with a non supported format', async function () { 75 it('Should fail with a non supported format', async function () {
77 const embedUrl = 'http://localhost:9001/videos/watch/' + server.video.uuid 76 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.video.uuid}`
78 77
79 await checkParamEmbed(server, embedUrl, 501, { format: 'xml' }) 78 await checkParamEmbed(server, embedUrl, 501, { format: 'xml' })
80 }) 79 })
81 80
82 it('Should succeed with the correct params', async function () { 81 it('Should succeed with the correct params', async function () {
83 const embedUrl = 'http://localhost:9001/videos/watch/' + server.video.uuid 82 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.video.uuid}`
84 const query = { 83 const query = {
85 format: 'json', 84 format: 'json',
86 maxheight: 400, 85 maxheight: 400,
@@ -91,8 +90,8 @@ describe('Test services API validators', function () {
91 }) 90 })
92 }) 91 })
93 92
94 after(function () { 93 after(async function () {
95 killallServers([ server ]) 94 await cleanupTests([ server ])
96 }) 95 })
97}) 96})
98 97
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 32619d7e1..14ee20d45 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -4,13 +4,12 @@ import 'mocha'
4import * as io from 'socket.io-client' 4import * as io from 'socket.io-client'
5 5
6import { 6import {
7 flushTests, 7 cleanupTests,
8 flushAndRunServer,
8 immutableAssign, 9 immutableAssign,
9 killallServers,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 makePutBodyRequest, 12 makePutBodyRequest,
13 flushAndRunServer,
14 ServerInfo, 13 ServerInfo,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
16 wait 15 wait
@@ -234,7 +233,7 @@ describe('Test user notifications API validators', function () {
234 233
235 describe('When connecting to my notification socket', function () { 234 describe('When connecting to my notification socket', function () {
236 it('Should fail with no token', function (next) { 235 it('Should fail with no token', function (next) {
237 const socket = io('http://localhost:9001/user-notifications', { reconnection: false }) 236 const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false })
238 237
239 socket.on('error', () => { 238 socket.on('error', () => {
240 socket.removeListener('error', this) 239 socket.removeListener('error', this)
@@ -249,7 +248,7 @@ describe('Test user notifications API validators', function () {
249 }) 248 })
250 249
251 it('Should fail with an invalid token', function (next) { 250 it('Should fail with an invalid token', function (next) {
252 const socket = io('http://localhost:9001/user-notifications', { 251 const socket = io(`http://localhost:${server.port}/user-notifications`, {
253 query: { accessToken: 'bad_access_token' }, 252 query: { accessToken: 'bad_access_token' },
254 reconnection: false 253 reconnection: false
255 }) 254 })
@@ -267,7 +266,7 @@ describe('Test user notifications API validators', function () {
267 }) 266 })
268 267
269 it('Should success with the correct token', function (next) { 268 it('Should success with the correct token', function (next) {
270 const socket = io('http://localhost:9001/user-notifications', { 269 const socket = io(`http://localhost:${server.port}/user-notifications`, {
271 query: { accessToken: server.accessToken }, 270 query: { accessToken: server.accessToken },
272 reconnection: false 271 reconnection: false
273 }) 272 })
@@ -286,7 +285,7 @@ describe('Test user notifications API validators', function () {
286 }) 285 })
287 }) 286 })
288 287
289 after(function () { 288 after(async function () {
290 killallServers([ server ]) 289 await cleanupTests([ server ])
291 }) 290 })
292}) 291})
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts
index 1fe67fa7c..fa36c4078 100644
--- a/server/tests/api/check-params/user-subscriptions.ts
+++ b/server/tests/api/check-params/user-subscriptions.ts
@@ -3,13 +3,12 @@
3import 'mocha' 3import 'mocha'
4 4
5import { 5import {
6 cleanupTests,
6 createUser, 7 createUser,
7 flushTests, 8 flushAndRunServer,
8 killallServers,
9 makeDeleteRequest, 9 makeDeleteRequest,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 flushAndRunServer,
13 ServerInfo, 12 ServerInfo,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 userLogin 14 userLogin
@@ -113,7 +112,7 @@ describe('Test user subscriptions API validators', function () {
113 await makePostBodyRequest({ 112 await makePostBodyRequest({
114 url: server.url, 113 url: server.url,
115 path, 114 path,
116 fields: { uri: 'user1_channel@localhost:9001' }, 115 fields: { uri: 'user1_channel@localhost:' + server.port },
117 statusCodeExpected: 401 116 statusCodeExpected: 401
118 }) 117 })
119 }) 118 })
@@ -151,7 +150,7 @@ describe('Test user subscriptions API validators', function () {
151 url: server.url, 150 url: server.url,
152 path, 151 path,
153 token: server.accessToken, 152 token: server.accessToken,
154 fields: { uri: 'user1_channel@localhost:9001' }, 153 fields: { uri: 'user1_channel@localhost:' + server.port },
155 statusCodeExpected: 204 154 statusCodeExpected: 204
156 }) 155 })
157 156
@@ -163,7 +162,7 @@ describe('Test user subscriptions API validators', function () {
163 it('Should fail with a non authenticated user', async function () { 162 it('Should fail with a non authenticated user', async function () {
164 await makeGetRequest({ 163 await makeGetRequest({
165 url: server.url, 164 url: server.url,
166 path: path + '/user1_channel@localhost:9001', 165 path: path + '/user1_channel@localhost:' + server.port,
167 statusCodeExpected: 401 166 statusCodeExpected: 401
168 }) 167 })
169 }) 168 })
@@ -194,7 +193,7 @@ describe('Test user subscriptions API validators', function () {
194 it('Should fail with an unknown subscription', async function () { 193 it('Should fail with an unknown subscription', async function () {
195 await makeGetRequest({ 194 await makeGetRequest({
196 url: server.url, 195 url: server.url,
197 path: path + '/root1@localhost:9001', 196 path: path + '/root1@localhost:' + server.port,
198 token: server.accessToken, 197 token: server.accessToken,
199 statusCodeExpected: 404 198 statusCodeExpected: 404
200 }) 199 })
@@ -203,7 +202,7 @@ describe('Test user subscriptions API validators', function () {
203 it('Should succeed with the correct parameters', async function () { 202 it('Should succeed with the correct parameters', async function () {
204 await makeGetRequest({ 203 await makeGetRequest({
205 url: server.url, 204 url: server.url,
206 path: path + '/user1_channel@localhost:9001', 205 path: path + '/user1_channel@localhost:' + server.port,
207 token: server.accessToken, 206 token: server.accessToken,
208 statusCodeExpected: 200 207 statusCodeExpected: 200
209 }) 208 })
@@ -243,7 +242,7 @@ describe('Test user subscriptions API validators', function () {
243 await makeGetRequest({ 242 await makeGetRequest({
244 url: server.url, 243 url: server.url,
245 path: existPath, 244 path: existPath,
246 query: { 'uris[]': 'coucou@localhost:9001' }, 245 query: { 'uris[]': 'coucou@localhost:' + server.port },
247 token: server.accessToken, 246 token: server.accessToken,
248 statusCodeExpected: 200 247 statusCodeExpected: 200
249 }) 248 })
@@ -254,7 +253,7 @@ describe('Test user subscriptions API validators', function () {
254 it('Should fail with a non authenticated user', async function () { 253 it('Should fail with a non authenticated user', async function () {
255 await makeDeleteRequest({ 254 await makeDeleteRequest({
256 url: server.url, 255 url: server.url,
257 path: path + '/user1_channel@localhost:9001', 256 path: path + '/user1_channel@localhost:' + server.port,
258 statusCodeExpected: 401 257 statusCodeExpected: 401
259 }) 258 })
260 }) 259 })
@@ -285,7 +284,7 @@ describe('Test user subscriptions API validators', function () {
285 it('Should fail with an unknown subscription', async function () { 284 it('Should fail with an unknown subscription', async function () {
286 await makeDeleteRequest({ 285 await makeDeleteRequest({
287 url: server.url, 286 url: server.url,
288 path: path + '/root1@localhost:9001', 287 path: path + '/root1@localhost:' + server.port,
289 token: server.accessToken, 288 token: server.accessToken,
290 statusCodeExpected: 404 289 statusCodeExpected: 404
291 }) 290 })
@@ -294,14 +293,14 @@ describe('Test user subscriptions API validators', function () {
294 it('Should succeed with the correct parameters', async function () { 293 it('Should succeed with the correct parameters', async function () {
295 await makeDeleteRequest({ 294 await makeDeleteRequest({
296 url: server.url, 295 url: server.url,
297 path: path + '/user1_channel@localhost:9001', 296 path: path + '/user1_channel@localhost:' + server.port,
298 token: server.accessToken, 297 token: server.accessToken,
299 statusCodeExpected: 204 298 statusCodeExpected: 204
300 }) 299 })
301 }) 300 })
302 }) 301 })
303 302
304 after(function () { 303 after(async function () {
305 killallServers([ server ]) 304 await cleanupTests([ server ])
306 }) 305 })
307}) 306})
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index d2fea65f6..5935104a5 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -7,6 +7,7 @@ import { UserRole, VideoImport, VideoImportState } from '../../../../shared'
7 7
8import { 8import {
9 blockUser, 9 blockUser,
10 cleanupTests,
10 createUser, 11 createUser,
11 deleteMe, 12 deleteMe,
12 flushAndRunServer, 13 flushAndRunServer,
@@ -14,7 +15,6 @@ import {
14 getMyUserVideoRating, 15 getMyUserVideoRating,
15 getUsersList, 16 getUsersList,
16 immutableAssign, 17 immutableAssign,
17 killallServers,
18 makeGetRequest, 18 makeGetRequest,
19 makePostBodyRequest, 19 makePostBodyRequest,
20 makePutBodyRequest, 20 makePutBodyRequest,
@@ -713,7 +713,7 @@ describe('Test users API validators', function () {
713 }) 713 })
714 714
715 it('Should fail if we register a user with the same email', async function () { 715 it('Should fail if we register a user with the same email', async function () {
716 const fields = immutableAssign(baseCorrectParams, { email: 'admin1@example.com' }) 716 const fields = immutableAssign(baseCorrectParams, { email: 'admin' + server.internalServerNumber + '@example.com' })
717 717
718 await makePostBodyRequest({ 718 await makePostBodyRequest({
719 url: server.url, 719 url: server.url,
@@ -897,7 +897,7 @@ describe('Test users API validators', function () {
897 }) 897 })
898 }) 898 })
899 899
900 after(function () { 900 after(async function () {
901 killallServers([ server, serverWithRegistrationDisabled ]) 901 await cleanupTests([ server, serverWithRegistrationDisabled ])
902 }) 902 })
903}) 903})
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts
index e2813d470..bf29f8d4d 100644
--- a/server/tests/api/check-params/video-abuses.ts
+++ b/server/tests/api/check-params/video-abuses.ts
@@ -3,13 +3,12 @@
3import 'mocha' 3import 'mocha'
4 4
5import { 5import {
6 cleanupTests,
6 createUser, 7 createUser,
7 deleteVideoAbuse, 8 deleteVideoAbuse,
8 flushTests, 9 flushAndRunServer,
9 killallServers,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 flushAndRunServer,
13 ServerInfo, 12 ServerInfo,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 updateVideoAbuse, 14 updateVideoAbuse,
@@ -188,7 +187,7 @@ describe('Test video abuses API validators', function () {
188 }) 187 })
189 }) 188 })
190 189
191 after(function () { 190 after(async function () {
192 killallServers([ server ]) 191 await cleanupTests([ server ])
193 }) 192 })
194}) 193})
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index f9c7d9e9a..6466888fb 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -3,6 +3,7 @@
3import 'mocha' 3import 'mocha'
4 4
5import { 5import {
6 cleanupTests,
6 createUser, 7 createUser,
7 doubleFollow, 8 doubleFollow,
8 flushAndRunMultipleServers, 9 flushAndRunMultipleServers,
@@ -247,7 +248,7 @@ describe('Test video blacklist API validators', function () {
247 }) 248 })
248 }) 249 })
249 250
250 after(function () { 251 after(async function () {
251 killallServers(servers) 252 await cleanupTests(servers)
252 }) 253 })
253}) 254})
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 64265865a..4a373d43d 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -2,13 +2,12 @@
2 2
3import 'mocha' 3import 'mocha'
4import { 4import {
5 cleanupTests,
5 createUser, 6 createUser,
6 flushTests, 7 flushAndRunServer,
7 killallServers,
8 makeDeleteRequest, 8 makeDeleteRequest,
9 makeGetRequest, 9 makeGetRequest,
10 makeUploadRequest, 10 makeUploadRequest,
11 flushAndRunServer,
12 ServerInfo, 11 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 uploadVideo, 13 uploadVideo,
@@ -269,7 +268,7 @@ describe('Test video captions API validator', function () {
269 }) 268 })
270 }) 269 })
271 270
272 after(function () { 271 after(async function () {
273 killallServers([ server ]) 272 await cleanupTests([ server ])
274 }) 273 })
275}) 274})
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 06da4f541..65bc20613 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -4,19 +4,16 @@ import * as chai from 'chai'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import 'mocha' 5import 'mocha'
6import { 6import {
7 cleanupTests,
7 createUser, 8 createUser,
8 deleteVideoChannel, 9 deleteVideoChannel,
9 flushTests, 10 flushAndRunServer,
10 getAccountVideoChannelsList, 11 getAccountVideoChannelsList,
11 getMyUserInformation,
12 getVideoChannelsList,
13 immutableAssign, 12 immutableAssign,
14 killallServers,
15 makeGetRequest, 13 makeGetRequest,
16 makePostBodyRequest, 14 makePostBodyRequest,
17 makePutBodyRequest, 15 makePutBodyRequest,
18 makeUploadRequest, 16 makeUploadRequest,
19 flushAndRunServer,
20 ServerInfo, 17 ServerInfo,
21 setAccessTokensToServers, 18 setAccessTokensToServers,
22 userLogin 19 userLogin
@@ -26,7 +23,6 @@ import {
26 checkBadSortPagination, 23 checkBadSortPagination,
27 checkBadStartPagination 24 checkBadStartPagination
28} from '../../../../shared/extra-utils/requests/check-api-params' 25} from '../../../../shared/extra-utils/requests/check-api-params'
29import { User } from '../../../../shared/models/users'
30import { join } from 'path' 26import { join } from 'path'
31 27
32const expect = chai.expect 28const expect = chai.expect
@@ -310,7 +306,7 @@ describe('Test video channels API validator', function () {
310 }) 306 })
311 }) 307 })
312 308
313 after(function () { 309 after(async function () {
314 killallServers([ server ]) 310 await cleanupTests([ server ])
315 }) 311 })
316}) 312})
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index dfa4c29b6..5cf90bacc 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -3,9 +3,9 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 cleanupTests,
6 createUser, 7 createUser,
7 flushAndRunServer, 8 flushAndRunServer,
8 killallServers,
9 makeDeleteRequest, 9 makeDeleteRequest,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
@@ -258,7 +258,7 @@ describe('Test video comments API validator', function () {
258 it('Should return conflict on comment thread add') 258 it('Should return conflict on comment thread add')
259 }) 259 })
260 260
261 after(function () { 261 after(async function () {
262 killallServers([ server ]) 262 await cleanupTests([ server ])
263 }) 263 })
264}) 264})
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 82fdc0667..8ff115e7b 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -5,15 +5,14 @@ import 'mocha'
5import { join } from 'path' 5import { join } from 'path'
6import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' 6import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'
7import { 7import {
8 cleanupTests,
8 createUser, 9 createUser,
9 flushTests, 10 flushAndRunServer,
10 getMyUserInformation, 11 getMyUserInformation,
11 immutableAssign, 12 immutableAssign,
12 killallServers,
13 makeGetRequest, 13 makeGetRequest,
14 makePostBodyRequest, 14 makePostBodyRequest,
15 makeUploadRequest, 15 makeUploadRequest,
16 flushAndRunServer,
17 ServerInfo, 16 ServerInfo,
18 setAccessTokensToServers, 17 setAccessTokensToServers,
19 updateCustomSubConfig, 18 updateCustomSubConfig,
@@ -311,7 +310,7 @@ describe('Test video imports API validator', function () {
311 }) 310 })
312 }) 311 })
313 312
314 after(function () { 313 after(async function () {
315 killallServers([ server ]) 314 await cleanupTests([ server ])
316 }) 315 })
317}) 316})
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 0edb51682..b7b94c035 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -3,20 +3,20 @@
3import 'mocha' 3import 'mocha'
4import { 4import {
5 addVideoInPlaylist, 5 addVideoInPlaylist,
6 cleanupTests,
6 createVideoPlaylist, 7 createVideoPlaylist,
7 deleteVideoPlaylist, 8 deleteVideoPlaylist,
8 flushTests, 9 flushAndRunServer,
9 generateUserAccessToken, 10 generateUserAccessToken,
10 getAccountPlaylistsListWithToken, 11 getAccountPlaylistsListWithToken,
11 getVideoPlaylist, 12 getVideoPlaylist,
12 immutableAssign, 13 immutableAssign,
13 killallServers,
14 makeGetRequest, 14 makeGetRequest,
15 removeVideoFromPlaylist, 15 removeVideoFromPlaylist,
16 reorderVideosPlaylist, 16 reorderVideosPlaylist,
17 flushAndRunServer,
18 ServerInfo, 17 ServerInfo,
19 setAccessTokensToServers, setDefaultVideoChannel, 18 setAccessTokensToServers,
19 setDefaultVideoChannel,
20 updateVideoPlaylist, 20 updateVideoPlaylist,
21 updateVideoPlaylistElement, 21 updateVideoPlaylistElement,
22 uploadVideoAndGetId 22 uploadVideoAndGetId
@@ -668,7 +668,7 @@ describe('Test video playlists API validator', function () {
668 }) 668 })
669 }) 669 })
670 670
671 after(function () { 671 after(async function () {
672 killallServers([ server ]) 672 await cleanupTests([ server ])
673 }) 673 })
674}) 674})
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts
index 82cc0f638..babef8223 100644
--- a/server/tests/api/check-params/videos-filter.ts
+++ b/server/tests/api/check-params/videos-filter.ts
@@ -2,14 +2,14 @@
2 2
3import 'mocha' 3import 'mocha'
4import { 4import {
5 cleanupTests,
5 createUser, 6 createUser,
6 createVideoPlaylist, 7 createVideoPlaylist,
7 flushTests,
8 killallServers,
9 makeGetRequest,
10 flushAndRunServer, 8 flushAndRunServer,
9 makeGetRequest,
11 ServerInfo, 10 ServerInfo,
12 setAccessTokensToServers, setDefaultVideoChannel, 11 setAccessTokensToServers,
12 setDefaultVideoChannel,
13 userLogin 13 userLogin
14} from '../../../../shared/extra-utils' 14} from '../../../../shared/extra-utils'
15import { UserRole } from '../../../../shared/models/users' 15import { UserRole } from '../../../../shared/models/users'
@@ -129,7 +129,7 @@ describe('Test videos filters', function () {
129 }) 129 })
130 }) 130 })
131 131
132 after(function () { 132 after(async function () {
133 killallServers([ server ]) 133 await cleanupTests([ server ])
134 }) 134 })
135}) 135})
diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts
index 32f65f510..3739e3fad 100644
--- a/server/tests/api/check-params/videos-history.ts
+++ b/server/tests/api/check-params/videos-history.ts
@@ -5,12 +5,11 @@ import 'mocha'
5import { 5import {
6 checkBadCountPagination, 6 checkBadCountPagination,
7 checkBadStartPagination, 7 checkBadStartPagination,
8 flushTests, 8 cleanupTests,
9 killallServers, 9 flushAndRunServer,
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 makePutBodyRequest, 12 makePutBodyRequest,
13 flushAndRunServer,
14 ServerInfo, 13 ServerInfo,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
16 uploadVideo 15 uploadVideo
@@ -126,7 +125,7 @@ describe('Test videos history API validator', function () {
126 }) 125 })
127 }) 126 })
128 127
129 after(function () { 128 after(async function () {
130 killallServers([ server ]) 129 await cleanupTests([ server ])
131 }) 130 })
132}) 131})
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index bc321e91f..51e592a15 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -6,16 +6,28 @@ import 'mocha'
6import { join } from 'path' 6import { join } from 'path'
7import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' 7import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'
8import { 8import {
9 createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, 9 cleanupTests,
10 makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, uploadVideo, 10 createUser,
11 flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin, updateCustomSubConfig 11 flushAndRunServer,
12 getMyUserInformation,
13 getVideo,
14 getVideosList,
15 immutableAssign,
16 makeDeleteRequest,
17 makeGetRequest,
18 makePutBodyRequest,
19 makeUploadRequest,
20 removeVideo,
21 ServerInfo,
22 setAccessTokensToServers,
23 userLogin,
24 root
12} from '../../../../shared/extra-utils' 25} from '../../../../shared/extra-utils'
13import { 26import {
14 checkBadCountPagination, 27 checkBadCountPagination,
15 checkBadSortPagination, 28 checkBadSortPagination,
16 checkBadStartPagination 29 checkBadStartPagination
17} from '../../../../shared/extra-utils/requests/check-api-params' 30} from '../../../../shared/extra-utils/requests/check-api-params'
18import { getAccountsList } from '../../../../shared/extra-utils/users/accounts'
19 31
20const expect = chai.expect 32const expect = chai.expect
21 33
@@ -166,7 +178,7 @@ describe('Test videos API validator', function () {
166 describe('When adding a video', function () { 178 describe('When adding a video', function () {
167 let baseCorrectParams 179 let baseCorrectParams
168 const baseCorrectAttaches = { 180 const baseCorrectAttaches = {
169 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.webm') 181 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')
170 } 182 }
171 183
172 before(function () { 184 before(function () {
@@ -326,15 +338,15 @@ describe('Test videos API validator', function () {
326 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 338 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
327 }) 339 })
328 340
329 it('Should fail without an incorrect input file', async function () { 341 it('Should fail with an incorrect input file', async function () {
330 const fields = baseCorrectParams 342 const fields = baseCorrectParams
331 let attaches = { 343 let attaches = {
332 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') 344 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm')
333 } 345 }
334 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 346 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
335 347
336 attaches = { 348 attaches = {
337 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mkv') 349 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv')
338 } 350 }
339 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 351 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
340 }) 352 })
@@ -342,8 +354,8 @@ describe('Test videos API validator', function () {
342 it('Should fail with an incorrect thumbnail file', async function () { 354 it('Should fail with an incorrect thumbnail file', async function () {
343 const fields = baseCorrectParams 355 const fields = baseCorrectParams
344 const attaches = { 356 const attaches = {
345 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), 357 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
346 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 358 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
347 } 359 }
348 360
349 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 361 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -352,8 +364,8 @@ describe('Test videos API validator', function () {
352 it('Should fail with a big thumbnail file', async function () { 364 it('Should fail with a big thumbnail file', async function () {
353 const fields = baseCorrectParams 365 const fields = baseCorrectParams
354 const attaches = { 366 const attaches = {
355 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), 367 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
356 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 368 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
357 } 369 }
358 370
359 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 371 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -362,8 +374,8 @@ describe('Test videos API validator', function () {
362 it('Should fail with an incorrect preview file', async function () { 374 it('Should fail with an incorrect preview file', async function () {
363 const fields = baseCorrectParams 375 const fields = baseCorrectParams
364 const attaches = { 376 const attaches = {
365 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), 377 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
366 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 378 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
367 } 379 }
368 380
369 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 381 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -372,8 +384,8 @@ describe('Test videos API validator', function () {
372 it('Should fail with a big preview file', async function () { 384 it('Should fail with a big preview file', async function () {
373 const fields = baseCorrectParams 385 const fields = baseCorrectParams
374 const attaches = { 386 const attaches = {
375 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), 387 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
376 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 388 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
377 } 389 }
378 390
379 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 391 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -398,7 +410,7 @@ describe('Test videos API validator', function () {
398 410
399 { 411 {
400 const attaches = immutableAssign(baseCorrectAttaches, { 412 const attaches = immutableAssign(baseCorrectAttaches, {
401 videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 413 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
402 }) 414 })
403 415
404 await makeUploadRequest({ 416 await makeUploadRequest({
@@ -413,7 +425,7 @@ describe('Test videos API validator', function () {
413 425
414 { 426 {
415 const attaches = immutableAssign(baseCorrectAttaches, { 427 const attaches = immutableAssign(baseCorrectAttaches, {
416 videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.ogv') 428 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.ogv')
417 }) 429 })
418 430
419 await makeUploadRequest({ 431 await makeUploadRequest({
@@ -550,7 +562,7 @@ describe('Test videos API validator', function () {
550 it('Should fail with an incorrect thumbnail file', async function () { 562 it('Should fail with an incorrect thumbnail file', async function () {
551 const fields = baseCorrectParams 563 const fields = baseCorrectParams
552 const attaches = { 564 const attaches = {
553 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') 565 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
554 } 566 }
555 567
556 await makeUploadRequest({ 568 await makeUploadRequest({
@@ -566,7 +578,7 @@ describe('Test videos API validator', function () {
566 it('Should fail with a big thumbnail file', async function () { 578 it('Should fail with a big thumbnail file', async function () {
567 const fields = baseCorrectParams 579 const fields = baseCorrectParams
568 const attaches = { 580 const attaches = {
569 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 581 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
570 } 582 }
571 583
572 await makeUploadRequest({ 584 await makeUploadRequest({
@@ -582,7 +594,7 @@ describe('Test videos API validator', function () {
582 it('Should fail with an incorrect preview file', async function () { 594 it('Should fail with an incorrect preview file', async function () {
583 const fields = baseCorrectParams 595 const fields = baseCorrectParams
584 const attaches = { 596 const attaches = {
585 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') 597 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
586 } 598 }
587 599
588 await makeUploadRequest({ 600 await makeUploadRequest({
@@ -598,7 +610,7 @@ describe('Test videos API validator', function () {
598 it('Should fail with a big preview file', async function () { 610 it('Should fail with a big preview file', async function () {
599 const fields = baseCorrectParams 611 const fields = baseCorrectParams
600 const attaches = { 612 const attaches = {
601 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 613 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
602 } 614 }
603 615
604 await makeUploadRequest({ 616 await makeUploadRequest({
@@ -728,7 +740,7 @@ describe('Test videos API validator', function () {
728 }) 740 })
729 }) 741 })
730 742
731 after(function () { 743 after(async function () {
732 killallServers([ server ]) 744 await cleanupTests([ server ])
733 }) 745 })
734}) 746})