diff options
Diffstat (limited to 'server/tests/cli')
-rw-r--r-- | server/tests/cli/create-import-video-file-job.ts | 6 | ||||
-rw-r--r-- | server/tests/cli/create-transcoding-job.ts | 15 | ||||
-rw-r--r-- | server/tests/cli/optimize-old-videos.ts | 4 | ||||
-rw-r--r-- | server/tests/cli/peertube.ts | 19 | ||||
-rw-r--r-- | server/tests/cli/plugins.ts | 2 | ||||
-rw-r--r-- | server/tests/cli/prune-storage.ts | 19 | ||||
-rw-r--r-- | server/tests/cli/update-host.ts | 2 |
7 files changed, 36 insertions, 31 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index aca3216bb..dac049fe4 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
@@ -71,7 +71,7 @@ describe('Test create import video jobs', function () { | |||
71 | const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body | 71 | const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body |
72 | 72 | ||
73 | expect(videoDetail.files).to.have.lengthOf(2) | 73 | expect(videoDetail.files).to.have.lengthOf(2) |
74 | const [originalVideo, transcodedVideo] = videoDetail.files | 74 | const [ originalVideo, transcodedVideo ] = videoDetail.files |
75 | assertVideoProperties(originalVideo, 720, 'webm', 218910) | 75 | assertVideoProperties(originalVideo, 720, 'webm', 218910) |
76 | assertVideoProperties(transcodedVideo, 480, 'webm', 69217) | 76 | assertVideoProperties(transcodedVideo, 480, 'webm', 69217) |
77 | 77 | ||
@@ -95,7 +95,7 @@ describe('Test create import video jobs', function () { | |||
95 | const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body | 95 | const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body |
96 | 96 | ||
97 | expect(videoDetail.files).to.have.lengthOf(4) | 97 | expect(videoDetail.files).to.have.lengthOf(4) |
98 | const [originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240] = videoDetail.files | 98 | const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetail.files |
99 | assertVideoProperties(originalVideo, 720, 'ogv', 140849) | 99 | assertVideoProperties(originalVideo, 720, 'ogv', 140849) |
100 | assertVideoProperties(transcodedVideo420, 480, 'mp4') | 100 | assertVideoProperties(transcodedVideo420, 480, 'mp4') |
101 | assertVideoProperties(transcodedVideo320, 360, 'mp4') | 101 | assertVideoProperties(transcodedVideo320, 360, 'mp4') |
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index 7897ff1b3..997a9a1fd 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
@@ -8,14 +8,13 @@ import { | |||
8 | doubleFollow, | 8 | doubleFollow, |
9 | execCLI, | 9 | execCLI, |
10 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
11 | flushTests, | ||
12 | getEnvCli, | 11 | getEnvCli, |
13 | getVideo, | 12 | getVideo, |
14 | getVideosList, | 13 | getVideosList, |
15 | killallServers, | ||
16 | ServerInfo, | 14 | ServerInfo, |
17 | setAccessTokensToServers, updateCustomSubConfig, | 15 | setAccessTokensToServers, |
18 | uploadVideo, wait | 16 | updateCustomSubConfig, |
17 | uploadVideo | ||
19 | } from '../../../shared/extra-utils' | 18 | } from '../../../shared/extra-utils' |
20 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' | 19 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' |
21 | 20 | ||
@@ -23,7 +22,7 @@ const expect = chai.expect | |||
23 | 22 | ||
24 | describe('Test create transcoding jobs', function () { | 23 | describe('Test create transcoding jobs', function () { |
25 | let servers: ServerInfo[] = [] | 24 | let servers: ServerInfo[] = [] |
26 | let videosUUID: string[] = [] | 25 | const videosUUID: string[] = [] |
27 | 26 | ||
28 | const config = { | 27 | const config = { |
29 | transcoding: { | 28 | transcoding: { |
@@ -54,7 +53,7 @@ describe('Test create transcoding jobs', function () { | |||
54 | await doubleFollow(servers[0], servers[1]) | 53 | await doubleFollow(servers[0], servers[1]) |
55 | 54 | ||
56 | for (let i = 1; i <= 5; i++) { | 55 | for (let i = 1; i <= 5; i++) { |
57 | const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video' + i }) | 56 | const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' + i }) |
58 | videosUUID.push(res.body.video.uuid) | 57 | videosUUID.push(res.body.video.uuid) |
59 | } | 58 | } |
60 | 59 | ||
@@ -90,7 +89,7 @@ describe('Test create transcoding jobs', function () { | |||
90 | const res = await getVideosList(server.url) | 89 | const res = await getVideosList(server.url) |
91 | const videos = res.body.data | 90 | const videos = res.body.data |
92 | 91 | ||
93 | let infoHashes: { [ id: number ]: string } | 92 | let infoHashes: { [id: number]: string } |
94 | 93 | ||
95 | for (const video of videos) { | 94 | for (const video of videos) { |
96 | const res2 = await getVideo(server.url, video.uuid) | 95 | const res2 = await getVideo(server.url, video.uuid) |
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts index de5d672f5..e2e13598f 100644 --- a/server/tests/cli/optimize-old-videos.ts +++ b/server/tests/cli/optimize-old-videos.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
@@ -28,7 +28,9 @@ const expect = chai.expect | |||
28 | 28 | ||
29 | describe('Test optimize old videos', function () { | 29 | describe('Test optimize old videos', function () { |
30 | let servers: ServerInfo[] = [] | 30 | let servers: ServerInfo[] = [] |
31 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
31 | let video1UUID: string | 32 | let video1UUID: string |
33 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
32 | let video2UUID: string | 34 | let video2UUID: string |
33 | 35 | ||
34 | before(async function () { | 36 | before(async function () { |
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index 15b6755f2..27fbde02d 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
@@ -6,15 +6,18 @@ import { | |||
6 | addVideoChannel, | 6 | addVideoChannel, |
7 | buildAbsoluteFixturePath, | 7 | buildAbsoluteFixturePath, |
8 | cleanupTests, | 8 | cleanupTests, |
9 | createUser, doubleFollow, | 9 | createUser, |
10 | doubleFollow, | ||
10 | execCLI, | 11 | execCLI, |
11 | flushAndRunServer, | 12 | flushAndRunServer, |
12 | getEnvCli, getLocalIdByUUID, | 13 | getEnvCli, |
14 | getLocalIdByUUID, | ||
13 | getVideo, | 15 | getVideo, |
14 | getVideosList, | 16 | getVideosList, |
15 | getVideosListWithToken, removeVideo, | 17 | removeVideo, |
16 | ServerInfo, | 18 | ServerInfo, |
17 | setAccessTokensToServers, uploadVideo, uploadVideoAndGetId, | 19 | setAccessTokensToServers, |
20 | uploadVideoAndGetId, | ||
18 | userLogin, | 21 | userLogin, |
19 | waitJobs | 22 | waitJobs |
20 | } from '../../../shared/extra-utils' | 23 | } from '../../../shared/extra-utils' |
@@ -101,7 +104,7 @@ describe('Test CLI wrapper', function () { | |||
101 | 104 | ||
102 | const videos: Video[] = res.body.data | 105 | const videos: Video[] = res.body.data |
103 | 106 | ||
104 | const video: VideoDetails = (await getVideo(server.url, videos[ 0 ].uuid)).body | 107 | const video: VideoDetails = (await getVideo(server.url, videos[0].uuid)).body |
105 | 108 | ||
106 | expect(video.name).to.equal('test upload') | 109 | expect(video.name).to.equal('test upload') |
107 | expect(video.support).to.equal('support_text') | 110 | expect(video.support).to.equal('support_text') |
@@ -250,7 +253,7 @@ describe('Test CLI wrapper', function () { | |||
250 | { | 253 | { |
251 | const env = getEnvCli(server) | 254 | const env = getEnvCli(server) |
252 | 255 | ||
253 | const params = `list-my-redundancies` | 256 | const params = 'list-my-redundancies' |
254 | const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`) | 257 | const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`) |
255 | 258 | ||
256 | expect(stdout).to.contain('super video') | 259 | expect(stdout).to.contain('super video') |
@@ -271,7 +274,7 @@ describe('Test CLI wrapper', function () { | |||
271 | 274 | ||
272 | { | 275 | { |
273 | const env = getEnvCli(server) | 276 | const env = getEnvCli(server) |
274 | const params = `list-my-redundancies` | 277 | const params = 'list-my-redundancies' |
275 | const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`) | 278 | const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`) |
276 | 279 | ||
277 | expect(stdout).to.not.contain('super video') | 280 | expect(stdout).to.not.contain('super video') |
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index a5257d671..7f19f14b7 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { | 4 | import { |
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 144e67c44..304c8ca56 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
@@ -11,9 +11,11 @@ import { | |||
11 | execCLI, | 11 | execCLI, |
12 | flushAndRunMultipleServers, | 12 | flushAndRunMultipleServers, |
13 | getAccount, | 13 | getAccount, |
14 | getEnvCli, makeGetRequest, makeRawRequest, | 14 | getEnvCli, |
15 | makeGetRequest, | ||
15 | ServerInfo, | 16 | ServerInfo, |
16 | setAccessTokensToServers, setDefaultVideoChannel, | 17 | setAccessTokensToServers, |
18 | setDefaultVideoChannel, | ||
17 | updateMyAvatar, | 19 | updateMyAvatar, |
18 | uploadVideo, | 20 | uploadVideo, |
19 | wait | 21 | wait |
@@ -22,7 +24,6 @@ import { Account, VideoPlaylistPrivacy } from '../../../shared/models' | |||
22 | import { createFile, readdir } from 'fs-extra' | 24 | import { createFile, readdir } from 'fs-extra' |
23 | import * as uuidv4 from 'uuid/v4' | 25 | import * as uuidv4 from 'uuid/v4' |
24 | import { join } from 'path' | 26 | import { join } from 'path' |
25 | import * as request from 'supertest' | ||
26 | 27 | ||
27 | const expect = chai.expect | 28 | const expect = chai.expect |
28 | 29 | ||
@@ -61,7 +62,7 @@ async function assertCountAreOkay (servers: ServerInfo[]) { | |||
61 | 62 | ||
62 | describe('Test prune storage scripts', function () { | 63 | describe('Test prune storage scripts', function () { |
63 | let servers: ServerInfo[] | 64 | let servers: ServerInfo[] |
64 | const badNames: { [ directory: string ]: string[] } = {} | 65 | const badNames: { [directory: string]: string[] } = {} |
65 | 66 | ||
66 | before(async function () { | 67 | before(async function () { |
67 | this.timeout(120000) | 68 | this.timeout(120000) |
@@ -92,20 +93,20 @@ describe('Test prune storage scripts', function () { | |||
92 | 93 | ||
93 | // Lazy load the remote avatar | 94 | // Lazy load the remote avatar |
94 | { | 95 | { |
95 | const res = await getAccount(servers[ 0 ].url, 'root@localhost:' + servers[ 1 ].port) | 96 | const res = await getAccount(servers[0].url, 'root@localhost:' + servers[1].port) |
96 | const account: Account = res.body | 97 | const account: Account = res.body |
97 | await makeGetRequest({ | 98 | await makeGetRequest({ |
98 | url: servers[ 0 ].url, | 99 | url: servers[0].url, |
99 | path: account.avatar.path, | 100 | path: account.avatar.path, |
100 | statusCodeExpected: 200 | 101 | statusCodeExpected: 200 |
101 | }) | 102 | }) |
102 | } | 103 | } |
103 | 104 | ||
104 | { | 105 | { |
105 | const res = await getAccount(servers[ 1 ].url, 'root@localhost:' + servers[ 0 ].port) | 106 | const res = await getAccount(servers[1].url, 'root@localhost:' + servers[0].port) |
106 | const account: Account = res.body | 107 | const account: Account = res.body |
107 | await makeGetRequest({ | 108 | await makeGetRequest({ |
108 | url: servers[ 1 ].url, | 109 | url: servers[1].url, |
109 | path: account.avatar.path, | 110 | path: account.avatar.path, |
110 | statusCodeExpected: 200 | 111 | statusCodeExpected: 200 |
111 | }) | 112 | }) |
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index 55c43b32f..2070f16f5 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |