aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/services.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-22 14:28:03 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-07-26 11:29:31 +0200
commit83903cb65d531a6b6b91715387493ba8312b264d (patch)
treefd172e26a483331e74f15a062743a9d40d4016d3 /server/tests/api/check-params/services.ts
parentc4fa01f7c45b66b112ebd08abce744b7c4041feb (diff)
downloadPeerTube-83903cb65d531a6b6b91715387493ba8312b264d.tar.gz
PeerTube-83903cb65d531a6b6b91715387493ba8312b264d.tar.zst
PeerTube-83903cb65d531a6b6b91715387493ba8312b264d.zip
Generate random uuid for video files
Diffstat (limited to 'server/tests/api/check-params/services.ts')
-rw-r--r--server/tests/api/check-params/services.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts
index 4c4a5cade..8d795fabc 100644
--- a/server/tests/api/check-params/services.ts
+++ b/server/tests/api/check-params/services.ts
@@ -24,7 +24,7 @@ describe('Test services API validators', function () {
24 await setAccessTokensToServers([ server ]) 24 await setAccessTokensToServers([ server ])
25 await setDefaultVideoChannel([ server ]) 25 await setDefaultVideoChannel([ server ])
26 26
27 server.store.video = await server.videos.upload({ attributes: { name: 'my super name' } }) 27 server.store.videoCreated = await server.videos.upload({ attributes: { name: 'my super name' } })
28 28
29 { 29 {
30 const created = await server.playlists.create({ 30 const created = await server.playlists.create({
@@ -47,7 +47,7 @@ describe('Test services API validators', function () {
47 }) 47 })
48 48
49 it('Should fail with an invalid host', async function () { 49 it('Should fail with an invalid host', async function () {
50 const embedUrl = 'http://hello.com/videos/watch/' + server.store.video.uuid 50 const embedUrl = 'http://hello.com/videos/watch/' + server.store.videoCreated.uuid
51 await checkParamEmbed(server, embedUrl) 51 await checkParamEmbed(server, embedUrl)
52 }) 52 })
53 53
@@ -62,37 +62,37 @@ describe('Test services API validators', function () {
62 }) 62 })
63 63
64 it('Should fail with an invalid path', async function () { 64 it('Should fail with an invalid path', async function () {
65 const embedUrl = `http://localhost:${server.port}/videos/watchs/${server.store.video.uuid}` 65 const embedUrl = `http://localhost:${server.port}/videos/watchs/${server.store.videoCreated.uuid}`
66 66
67 await checkParamEmbed(server, embedUrl) 67 await checkParamEmbed(server, embedUrl)
68 }) 68 })
69 69
70 it('Should fail with an invalid max height', async function () { 70 it('Should fail with an invalid max height', async function () {
71 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.video.uuid}` 71 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`
72 72
73 await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxheight: 'hello' }) 73 await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxheight: 'hello' })
74 }) 74 })
75 75
76 it('Should fail with an invalid max width', async function () { 76 it('Should fail with an invalid max width', async function () {
77 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.video.uuid}` 77 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`
78 78
79 await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxwidth: 'hello' }) 79 await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { maxwidth: 'hello' })
80 }) 80 })
81 81
82 it('Should fail with an invalid format', async function () { 82 it('Should fail with an invalid format', async function () {
83 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.video.uuid}` 83 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`
84 84
85 await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { format: 'blabla' }) 85 await checkParamEmbed(server, embedUrl, HttpStatusCode.BAD_REQUEST_400, { format: 'blabla' })
86 }) 86 })
87 87
88 it('Should fail with a non supported format', async function () { 88 it('Should fail with a non supported format', async function () {
89 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.video.uuid}` 89 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`
90 90
91 await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_IMPLEMENTED_501, { format: 'xml' }) 91 await checkParamEmbed(server, embedUrl, HttpStatusCode.NOT_IMPLEMENTED_501, { format: 'xml' })
92 }) 92 })
93 93
94 it('Should succeed with the correct params with a video', async function () { 94 it('Should succeed with the correct params with a video', async function () {
95 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.video.uuid}` 95 const embedUrl = `http://localhost:${server.port}/videos/watch/${server.store.videoCreated.uuid}`
96 const query = { 96 const query = {
97 format: 'json', 97 format: 'json',
98 maxheight: 400, 98 maxheight: 400,