aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/upload-quota.ts16
-rw-r--r--server/tests/api/check-params/video-imports.ts6
2 files changed, 10 insertions, 12 deletions
diff --git a/server/tests/api/check-params/upload-quota.ts b/server/tests/api/check-params/upload-quota.ts
index d0fbec415..c444663b8 100644
--- a/server/tests/api/check-params/upload-quota.ts
+++ b/server/tests/api/check-params/upload-quota.ts
@@ -3,13 +3,12 @@
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode, randomInt } from '@shared/core-utils' 5import { HttpStatusCode, randomInt } from '@shared/core-utils'
6import { getGoodVideoUrl, getMagnetURI, getMyVideoImports, importVideo } from '@shared/extra-utils/videos/video-imports' 6import { MyUser, VideoImportState, VideoPrivacy } from '@shared/models'
7import { MyUser, VideoImport, VideoImportState, VideoPrivacy } from '@shared/models'
8import { 7import {
9 cleanupTests, 8 cleanupTests,
10 flushAndRunServer, 9 flushAndRunServer,
11 getMyUserInformation, 10 getMyUserInformation,
12 immutableAssign, 11 ImportsCommand,
13 registerUser, 12 registerUser,
14 ServerInfo, 13 ServerInfo,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
@@ -83,16 +82,15 @@ describe('Test upload quota', function () {
83 channelId: server.videoChannel.id, 82 channelId: server.videoChannel.id,
84 privacy: VideoPrivacy.PUBLIC 83 privacy: VideoPrivacy.PUBLIC
85 } 84 }
86 await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { targetUrl: getGoodVideoUrl() })) 85 await server.importsCommand.importVideo({ attributes: { ...baseAttributes, targetUrl: ImportsCommand.getGoodVideoUrl() } })
87 await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { magnetUri: getMagnetURI() })) 86 await server.importsCommand.importVideo({ attributes: { ...baseAttributes, magnetUri: ImportsCommand.getMagnetURI() } })
88 await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { torrentfile: 'video-720p.torrent' as any })) 87 await server.importsCommand.importVideo({ attributes: { ...baseAttributes, torrentfile: 'video-720p.torrent' as any } })
89 88
90 await waitJobs([ server ]) 89 await waitJobs([ server ])
91 90
92 const res = await getMyVideoImports(server.url, server.accessToken) 91 const { total, data: videoImports } = await server.importsCommand.getMyVideoImports()
92 expect(total).to.equal(3)
93 93
94 expect(res.body.total).to.equal(3)
95 const videoImports: VideoImport[] = res.body.data
96 expect(videoImports).to.have.lengthOf(3) 94 expect(videoImports).to.have.lengthOf(3)
97 95
98 for (const videoImport of videoImports) { 96 for (const videoImport of videoImports) {
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index dae3860ef..ea473191e 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -13,6 +13,7 @@ import {
13 flushAndRunServer, 13 flushAndRunServer,
14 getMyUserInformation, 14 getMyUserInformation,
15 immutableAssign, 15 immutableAssign,
16 ImportsCommand,
16 makeGetRequest, 17 makeGetRequest,
17 makePostBodyRequest, 18 makePostBodyRequest,
18 makeUploadRequest, 19 makeUploadRequest,
@@ -20,7 +21,6 @@ import {
20 setAccessTokensToServers, 21 setAccessTokensToServers,
21 userLogin 22 userLogin
22} from '@shared/extra-utils' 23} from '@shared/extra-utils'
23import { getGoodVideoUrl, getMagnetURI } from '@shared/extra-utils/videos/video-imports'
24import { VideoPrivacy } from '@shared/models' 24import { VideoPrivacy } from '@shared/models'
25 25
26describe('Test video imports API validator', function () { 26describe('Test video imports API validator', function () {
@@ -74,7 +74,7 @@ describe('Test video imports API validator', function () {
74 74
75 before(function () { 75 before(function () {
76 baseCorrectParams = { 76 baseCorrectParams = {
77 targetUrl: getGoodVideoUrl(), 77 targetUrl: ImportsCommand.getGoodVideoUrl(),
78 name: 'my super name', 78 name: 'my super name',
79 category: 5, 79 category: 5,
80 licence: 1, 80 licence: 1,
@@ -301,7 +301,7 @@ describe('Test video imports API validator', function () {
301 }) 301 })
302 302
303 let fields = omit(baseCorrectParams, 'targetUrl') 303 let fields = omit(baseCorrectParams, 'targetUrl')
304 fields = immutableAssign(fields, { magnetUri: getMagnetURI() }) 304 fields = immutableAssign(fields, { magnetUri: ImportsCommand.getMagnetURI() })
305 305
306 await makePostBodyRequest({ 306 await makePostBodyRequest({
307 url: server.url, 307 url: server.url,