aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/services.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/services.ts')
-rw-r--r--server/tests/api/check-params/services.ts25
1 files changed, 12 insertions, 13 deletions
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