From 89d241a79c262b9775c233b73cff080043ebb5e6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 09:04:35 +0200 Subject: Shorter server command names --- server/tests/cli/create-import-video-file-job.ts | 22 +++++++------- server/tests/cli/create-transcoding-job.ts | 38 ++++++++++++------------ server/tests/cli/optimize-old-videos.ts | 18 +++++------ server/tests/cli/peertube.ts | 28 ++++++++--------- server/tests/cli/plugins.ts | 10 +++---- server/tests/cli/prune-storage.ts | 30 +++++++++---------- server/tests/cli/regenerate-thumbnails.ts | 20 ++++++------- server/tests/cli/reset-password.ts | 6 ++-- server/tests/cli/update-host.ts | 24 +++++++-------- 9 files changed, 98 insertions(+), 98 deletions(-) (limited to 'server/tests/cli') diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index b1d9da242..26f4bdc8d 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts @@ -35,12 +35,12 @@ describe('Test create import video jobs', function () { // Upload two videos for our needs { - const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video1' } }) + const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video1' } }) video1UUID = uuid } { - const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video2' } }) + const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video2' } }) video2UUID = uuid } @@ -50,16 +50,16 @@ describe('Test create import video jobs', function () { it('Should run a import job on video 1 with a lower resolution', async function () { const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm` - await servers[0].cliCommand.execWithEnv(command) + await servers[0].cli.execWithEnv(command) await waitJobs(servers) for (const server of servers) { - const { data: videos } = await server.videosCommand.list() + const { data: videos } = await server.videos.list() expect(videos).to.have.lengthOf(2) const video = videos.find(({ uuid }) => uuid === video1UUID) - const videoDetails = await server.videosCommand.get({ id: video.uuid }) + const videoDetails = await server.videos.get({ id: video.uuid }) expect(videoDetails.files).to.have.lengthOf(2) const [ originalVideo, transcodedVideo ] = videoDetails.files @@ -70,16 +70,16 @@ describe('Test create import video jobs', function () { it('Should run a import job on video 2 with the same resolution and a different extension', async function () { const command = `npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv` - await servers[1].cliCommand.execWithEnv(command) + await servers[1].cli.execWithEnv(command) await waitJobs(servers) for (const server of servers) { - const { data: videos } = await server.videosCommand.list() + const { data: videos } = await server.videos.list() expect(videos).to.have.lengthOf(2) const video = videos.find(({ uuid }) => uuid === video2UUID) - const videoDetails = await server.videosCommand.get({ id: video.uuid }) + const videoDetails = await server.videos.get({ id: video.uuid }) expect(videoDetails.files).to.have.lengthOf(4) const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetails.files @@ -92,16 +92,16 @@ describe('Test create import video jobs', function () { it('Should run a import job on video 2 with the same resolution and the same extension', async function () { const command = `npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm` - await servers[0].cliCommand.execWithEnv(command) + await servers[0].cli.execWithEnv(command) await waitJobs(servers) for (const server of servers) { - const { data: videos } = await server.videosCommand.list() + const { data: videos } = await server.videos.list() expect(videos).to.have.lengthOf(2) const video = videos.find(({ uuid }) => uuid === video1UUID) - const videoDetails = await server.videosCommand.get({ id: video.uuid }) + const videoDetails = await server.videos.get({ id: video.uuid }) expect(videoDetails.files).to.have.lengthOf(2) const [ video720, video480 ] = videoDetails.files diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index f629306e6..c9bbab802 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts @@ -42,12 +42,12 @@ describe('Test create transcoding jobs', function () { servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) - await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) + await servers[0].config.updateCustomSubConfig({ newConfig: config }) await doubleFollow(servers[0], servers[1]) for (let i = 1; i <= 5; i++) { - const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video' + i } }) + const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' + i } }) videosUUID.push(uuid) } @@ -58,11 +58,11 @@ describe('Test create transcoding jobs', function () { this.timeout(30000) for (const server of servers) { - const { data } = await server.videosCommand.list() + const { data } = await server.videos.list() expect(data).to.have.lengthOf(videosUUID.length) for (const video of data) { - const videoDetail = await server.videosCommand.get({ id: video.uuid }) + const videoDetail = await server.videos.get({ id: video.uuid }) expect(videoDetail.files).to.have.lengthOf(1) expect(videoDetail.streamingPlaylists).to.have.lengthOf(0) } @@ -72,16 +72,16 @@ describe('Test create transcoding jobs', function () { it('Should run a transcoding job on video 2', async function () { this.timeout(60000) - await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[1]}`) + await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[1]}`) await waitJobs(servers) for (const server of servers) { - const { data } = await server.videosCommand.list() + const { data } = await server.videos.list() let infoHashes: { [id: number]: string } for (const video of data) { - const videoDetail = await server.videosCommand.get({ id: video.uuid }) + const videoDetail = await server.videos.get({ id: video.uuid }) if (video.uuid === videosUUID[1]) { expect(videoDetail.files).to.have.lengthOf(4) @@ -110,15 +110,15 @@ describe('Test create transcoding jobs', function () { it('Should run a transcoding job on video 1 with resolution', async function () { this.timeout(60000) - await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[0]} -r 480`) + await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[0]} -r 480`) await waitJobs(servers) for (const server of servers) { - const { data } = await server.videosCommand.list() + const { data } = await server.videos.list() expect(data).to.have.lengthOf(videosUUID.length) - const videoDetails = await server.videosCommand.get({ id: videosUUID[0] }) + const videoDetails = await server.videos.get({ id: videosUUID[0] }) expect(videoDetails.files).to.have.lengthOf(2) expect(videoDetails.files[0].resolution.id).to.equal(720) @@ -131,12 +131,12 @@ describe('Test create transcoding jobs', function () { it('Should generate an HLS resolution', async function () { this.timeout(120000) - await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`) + await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`) await waitJobs(servers) for (const server of servers) { - const videoDetails = await server.videosCommand.get({ id: videosUUID[2] }) + const videoDetails = await server.videos.get({ id: videosUUID[2] }) expect(videoDetails.files).to.have.lengthOf(1) expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) @@ -150,12 +150,12 @@ describe('Test create transcoding jobs', function () { it('Should not duplicate an HLS resolution', async function () { this.timeout(120000) - await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`) + await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[2]} --generate-hls -r 480`) await waitJobs(servers) for (const server of servers) { - const videoDetails = await server.videosCommand.get({ id: videosUUID[2] }) + const videoDetails = await server.videos.get({ id: videosUUID[2] }) const files = videoDetails.streamingPlaylists[0].files expect(files).to.have.lengthOf(1) @@ -166,12 +166,12 @@ describe('Test create transcoding jobs', function () { it('Should generate all HLS resolutions', async function () { this.timeout(120000) - await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[3]} --generate-hls`) + await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[3]} --generate-hls`) await waitJobs(servers) for (const server of servers) { - const videoDetails = await server.videosCommand.get({ id: videosUUID[3] }) + const videoDetails = await server.videos.get({ id: videosUUID[3] }) expect(videoDetails.files).to.have.lengthOf(1) expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) @@ -185,14 +185,14 @@ describe('Test create transcoding jobs', function () { this.timeout(120000) config.transcoding.hls.enabled = true - await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) + await servers[0].config.updateCustomSubConfig({ newConfig: config }) - await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[4]}`) + await servers[0].cli.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[4]}`) await waitJobs(servers) for (const server of servers) { - const videoDetails = await server.videosCommand.get({ id: videosUUID[4] }) + const videoDetails = await server.videos.get({ id: videosUUID[4] }) expect(videoDetails.files).to.have.lengthOf(4) expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts index ef8603a33..eefc95a6d 100644 --- a/server/tests/cli/optimize-old-videos.ts +++ b/server/tests/cli/optimize-old-videos.ts @@ -41,8 +41,8 @@ describe('Test optimize old videos', function () { } // Upload two videos for our needs - await servers[0].videosCommand.upload({ attributes: { name: 'video1', fixture: tempFixturePath } }) - await servers[0].videosCommand.upload({ attributes: { name: 'video2', fixture: tempFixturePath } }) + await servers[0].videos.upload({ attributes: { name: 'video1', fixture: tempFixturePath } }) + await servers[0].videos.upload({ attributes: { name: 'video2', fixture: tempFixturePath } }) await waitJobs(servers) }) @@ -51,11 +51,11 @@ describe('Test optimize old videos', function () { this.timeout(30000) for (const server of servers) { - const { data } = await server.videosCommand.list() + const { data } = await server.videos.list() expect(data).to.have.lengthOf(2) for (const video of data) { - const videoDetails = await server.videosCommand.get({ id: video.uuid }) + const videoDetails = await server.videos.get({ id: video.uuid }) expect(videoDetails.files).to.have.lengthOf(1) } } @@ -64,29 +64,29 @@ describe('Test optimize old videos', function () { it('Should run optimize script', async function () { this.timeout(200000) - await servers[0].cliCommand.execWithEnv('npm run optimize-old-videos') + await servers[0].cli.execWithEnv('npm run optimize-old-videos') await waitJobs(servers) for (const server of servers) { - const { data } = await server.videosCommand.list() + const { data } = await server.videos.list() expect(data).to.have.lengthOf(2) for (const video of data) { - await server.videosCommand.view({ id: video.uuid }) + await server.videos.view({ id: video.uuid }) // Refresh video await waitJobs(servers) await wait(5000) await waitJobs(servers) - const videoDetails = await server.videosCommand.get({ id: video.uuid }) + const videoDetails = await server.videos.get({ id: video.uuid }) expect(videoDetails.files).to.have.lengthOf(1) const file = videoDetails.files[0] expect(file.size).to.be.below(8000000) - const path = servers[0].serversCommand.buildDirectory(join('videos', video.uuid + '-' + file.resolution.id + '.mp4')) + const path = servers[0].servers.buildDirectory(join('videos', video.uuid + '-' + file.resolution.id + '.mp4')) const bitrate = await getVideoFileBitrate(path) const fps = await getVideoFileFPS(path) const resolution = await getVideoFileResolution(path) diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index fe5f63191..a83aa7724 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts @@ -30,16 +30,16 @@ describe('Test CLI wrapper', function () { server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) - await server.usersCommand.create({ username: 'user_1', password: 'super_password' }) + await server.users.create({ username: 'user_1', password: 'super_password' }) - userAccessToken = await server.loginCommand.getAccessToken({ username: 'user_1', password: 'super_password' }) + userAccessToken = await server.login.getAccessToken({ username: 'user_1', password: 'super_password' }) { const attributes = { name: 'user_channel', displayName: 'User channel', support: 'super support text' } - await server.channelsCommand.create({ token: userAccessToken, attributes }) + await server.channels.create({ token: userAccessToken, attributes }) } - cliCommand = server.cliCommand + cliCommand = server.cli }) describe('Authentication and instance selection', function () { @@ -48,7 +48,7 @@ describe('Test CLI wrapper', function () { const stdout = await cliCommand.execWithEnv(`${cmd} token --url ${server.url} --username user_1 --password super_password`) const token = stdout.trim() - const body = await server.usersCommand.getMyInfo({ token }) + const body = await server.users.getMyInfo({ token }) expect(body.username).to.equal('user_1') }) @@ -103,10 +103,10 @@ describe('Test CLI wrapper', function () { }) it('Should have the video uploaded', async function () { - const { total, data } = await server.videosCommand.list() + const { total, data } = await server.videos.list() expect(total).to.equal(1) - const video = await server.videosCommand.get({ id: data[0].uuid }) + const video = await server.videos.get({ id: data[0].uuid }) expect(video.name).to.equal('test upload') expect(video.support).to.equal('support_text') expect(video.channel.name).to.equal('user_channel') @@ -128,19 +128,19 @@ describe('Test CLI wrapper', function () { await waitJobs([ server ]) - const { total, data } = await server.videosCommand.list() + const { total, data } = await server.videos.list() expect(total).to.equal(2) const video = data.find(v => v.name === 'small video - youtube') expect(video).to.not.be.undefined - const videoDetails = await server.videosCommand.get({ id: video.id }) + const videoDetails = await server.videos.get({ id: video.id }) expect(videoDetails.channel.name).to.equal('user_channel') expect(videoDetails.support).to.equal('super support text') expect(videoDetails.nsfw).to.be.false // So we can reimport it - await server.videosCommand.remove({ token: userAccessToken, id: video.id }) + await server.videos.remove({ token: userAccessToken, id: video.id }) }) it('Should import and override some imported attributes', async function () { @@ -155,13 +155,13 @@ describe('Test CLI wrapper', function () { await waitJobs([ server ]) { - const { total, data } = await server.videosCommand.list() + const { total, data } = await server.videos.list() expect(total).to.equal(2) const video = data.find(v => v.name === 'toto') expect(video).to.not.be.undefined - const videoDetails = await server.videosCommand.get({ id: video.id }) + const videoDetails = await server.videos.get({ id: video.id }) expect(videoDetails.channel.name).to.equal('user_channel') expect(videoDetails.support).to.equal('support') expect(videoDetails.nsfw).to.be.true @@ -225,10 +225,10 @@ describe('Test CLI wrapper', function () { servers = [ server, anotherServer ] await waitJobs(servers) - const { uuid } = await anotherServer.videosCommand.quickUpload({ name: 'super video' }) + const { uuid } = await anotherServer.videos.quickUpload({ name: 'super video' }) await waitJobs(servers) - video1Server2 = await server.videosCommand.getId({ uuid }) + video1Server2 = await server.videos.getId({ uuid }) }) it('Should add a redundancy', async function () { diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 5344bfc96..178a7a2d9 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -27,13 +27,13 @@ describe('Test plugin scripts', function () { const packagePath = PluginsCommand.getPluginTestPath() - await server.cliCommand.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`) + await server.cli.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`) }) it('Should install a theme from stateless CLI', async function () { this.timeout(60000) - await server.cliCommand.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`) + await server.cli.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`) }) it('Should have the theme and the plugin registered when we restart peertube', async function () { @@ -42,7 +42,7 @@ describe('Test plugin scripts', function () { await killallServers([ server ]) await reRunServer(server) - const config = await server.configCommand.getConfig() + const config = await server.config.getConfig() const plugin = config.plugin.registered .find(p => p.name === 'test') @@ -56,7 +56,7 @@ describe('Test plugin scripts', function () { it('Should uninstall a plugin from stateless CLI', async function () { this.timeout(60000) - await server.cliCommand.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`) + await server.cli.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`) }) it('Should have removed the plugin on another peertube restart', async function () { @@ -65,7 +65,7 @@ describe('Test plugin scripts', function () { await killallServers([ server ]) await reRunServer(server) - const config = await server.configCommand.getConfig() + const config = await server.config.getConfig() const plugin = config.plugin.registered .find(p => p.name === 'test') diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index a4556312b..9912a36e0 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts @@ -24,13 +24,13 @@ import { VideoPlaylistPrivacy } from '@shared/models' const expect = chai.expect async function countFiles (server: ServerInfo, directory: string) { - const files = await readdir(server.serversCommand.buildDirectory(directory)) + const files = await readdir(server.servers.buildDirectory(directory)) return files.length } async function assertNotExists (server: ServerInfo, directory: string, substring: string) { - const files = await readdir(server.serversCommand.buildDirectory(directory)) + const files = await readdir(server.servers.buildDirectory(directory)) for (const f of files) { expect(f).to.not.contain(substring) @@ -68,16 +68,16 @@ describe('Test prune storage scripts', function () { await setDefaultVideoChannel(servers) for (const server of servers) { - await server.videosCommand.upload({ attributes: { name: 'video 1' } }) - await server.videosCommand.upload({ attributes: { name: 'video 2' } }) + await server.videos.upload({ attributes: { name: 'video 1' } }) + await server.videos.upload({ attributes: { name: 'video 2' } }) - await server.usersCommand.updateMyAvatar({ fixture: 'avatar.png' }) + await server.users.updateMyAvatar({ fixture: 'avatar.png' }) - await server.playlistsCommand.create({ + await server.playlists.create({ attributes: { displayName: 'playlist', privacy: VideoPlaylistPrivacy.PUBLIC, - videoChannelId: server.videoChannel.id, + videoChannelId: server.store.channel.id, thumbnailfile: 'thumbnail.jpg' } }) @@ -87,7 +87,7 @@ describe('Test prune storage scripts', function () { // Lazy load the remote avatar { - const account = await servers[0].accountsCommand.get({ accountName: 'root@localhost:' + servers[1].port }) + const account = await servers[0].accounts.get({ accountName: 'root@localhost:' + servers[1].port }) await makeGetRequest({ url: servers[0].url, path: account.avatar.path, @@ -96,7 +96,7 @@ describe('Test prune storage scripts', function () { } { - const account = await servers[1].accountsCommand.get({ accountName: 'root@localhost:' + servers[0].port }) + const account = await servers[1].accounts.get({ accountName: 'root@localhost:' + servers[0].port }) await makeGetRequest({ url: servers[1].url, path: account.avatar.path, @@ -119,7 +119,7 @@ describe('Test prune storage scripts', function () { it('Should create some dirty files', async function () { for (let i = 0; i < 2; i++) { { - const base = servers[0].serversCommand.buildDirectory('videos') + const base = servers[0].servers.buildDirectory('videos') const n1 = buildUUID() + '.mp4' const n2 = buildUUID() + '.webm' @@ -131,7 +131,7 @@ describe('Test prune storage scripts', function () { } { - const base = servers[0].serversCommand.buildDirectory('torrents') + const base = servers[0].servers.buildDirectory('torrents') const n1 = buildUUID() + '-240.torrent' const n2 = buildUUID() + '-480.torrent' @@ -143,7 +143,7 @@ describe('Test prune storage scripts', function () { } { - const base = servers[0].serversCommand.buildDirectory('thumbnails') + const base = servers[0].servers.buildDirectory('thumbnails') const n1 = buildUUID() + '.jpg' const n2 = buildUUID() + '.jpg' @@ -155,7 +155,7 @@ describe('Test prune storage scripts', function () { } { - const base = servers[0].serversCommand.buildDirectory('previews') + const base = servers[0].servers.buildDirectory('previews') const n1 = buildUUID() + '.jpg' const n2 = buildUUID() + '.jpg' @@ -167,7 +167,7 @@ describe('Test prune storage scripts', function () { } { - const base = servers[0].serversCommand.buildDirectory('avatars') + const base = servers[0].servers.buildDirectory('avatars') const n1 = buildUUID() + '.png' const n2 = buildUUID() + '.jpg' @@ -183,7 +183,7 @@ describe('Test prune storage scripts', function () { it('Should run prune storage', async function () { this.timeout(30000) - const env = servers[0].cliCommand.getEnv() + const env = servers[0].cli.getEnv() await CLICommand.exec(`echo y | ${env} npm run prune-storage`) }) diff --git a/server/tests/cli/regenerate-thumbnails.ts b/server/tests/cli/regenerate-thumbnails.ts index d59520783..2df1a1157 100644 --- a/server/tests/cli/regenerate-thumbnails.ts +++ b/server/tests/cli/regenerate-thumbnails.ts @@ -15,7 +15,7 @@ import { } from '../../../shared/extra-utils' async function testThumbnail (server: ServerInfo, videoId: number | string) { - const video = await server.videosCommand.get({ id: videoId }) + const video = await server.videos.get({ id: videoId }) const requests = [ makeRawRequest(join(server.url, video.thumbnailPath), HttpStatusCode.OK_200), @@ -47,22 +47,22 @@ describe('Test regenerate thumbnails script', function () { await doubleFollow(servers[0], servers[1]) { - const videoUUID1 = (await servers[0].videosCommand.quickUpload({ name: 'video 1' })).uuid - video1 = await servers[0].videosCommand.get({ id: videoUUID1 }) + const videoUUID1 = (await servers[0].videos.quickUpload({ name: 'video 1' })).uuid + video1 = await servers[0].videos.get({ id: videoUUID1 }) - thumbnail1Path = join(servers[0].serversCommand.buildDirectory('thumbnails'), basename(video1.thumbnailPath)) + thumbnail1Path = join(servers[0].servers.buildDirectory('thumbnails'), basename(video1.thumbnailPath)) - const videoUUID2 = (await servers[0].videosCommand.quickUpload({ name: 'video 2' })).uuid - video2 = await servers[0].videosCommand.get({ id: videoUUID2 }) + const videoUUID2 = (await servers[0].videos.quickUpload({ name: 'video 2' })).uuid + video2 = await servers[0].videos.get({ id: videoUUID2 }) } { - const videoUUID = (await servers[1].videosCommand.quickUpload({ name: 'video 3' })).uuid + const videoUUID = (await servers[1].videos.quickUpload({ name: 'video 3' })).uuid await waitJobs(servers) - remoteVideo = await servers[0].videosCommand.get({ id: videoUUID }) + remoteVideo = await servers[0].videos.get({ id: videoUUID }) - thumbnailRemotePath = join(servers[0].serversCommand.buildDirectory('thumbnails'), basename(remoteVideo.thumbnailPath)) + thumbnailRemotePath = join(servers[0].servers.buildDirectory('thumbnails'), basename(remoteVideo.thumbnailPath)) } await writeFile(thumbnail1Path, '') @@ -89,7 +89,7 @@ describe('Test regenerate thumbnails script', function () { it('Should regenerate local thumbnails from the CLI', async function () { this.timeout(15000) - await servers[0].cliCommand.execWithEnv(`npm run regenerate-thumbnails`) + await servers[0].cli.execWithEnv(`npm run regenerate-thumbnails`) }) it('Should have generated new thumbnail files', async function () { diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts index 5e1e1c2af..e0d6f220a 100644 --- a/server/tests/cli/reset-password.ts +++ b/server/tests/cli/reset-password.ts @@ -9,16 +9,16 @@ describe('Test reset password scripts', function () { server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) - await server.usersCommand.create({ username: 'user_1', password: 'super password' }) + await server.users.create({ username: 'user_1', password: 'super password' }) }) it('Should change the user password from CLI', async function () { this.timeout(60000) - const env = server.cliCommand.getEnv() + const env = server.cli.getEnv() await CLICommand.exec(`echo coucou | ${env} npm run reset-password -- -u user_1`) - await server.loginCommand.login({ user: { username: 'user_1', password: 'coucou' } }) + await server.login.login({ user: { username: 'user_1', password: 'coucou' } }) }) after(async function () { diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index d90b4a64d..d2d196456 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts @@ -30,11 +30,11 @@ describe('Test update host scripts', function () { await setAccessTokensToServers([ server ]) // Upload two videos for our needs - const { uuid: video1UUID } = await server.videosCommand.upload() - await server.videosCommand.upload() + const { uuid: video1UUID } = await server.videos.upload() + await server.videos.upload() // Create a user - await server.usersCommand.create({ username: 'toto', password: 'coucou' }) + await server.users.create({ username: 'toto', password: 'coucou' }) // Create channel const videoChannel = { @@ -42,11 +42,11 @@ describe('Test update host scripts', function () { displayName: 'second video channel', description: 'super video channel description' } - await server.channelsCommand.create({ attributes: videoChannel }) + await server.channels.create({ attributes: videoChannel }) // Create comments const text = 'my super first comment' - await server.commentsCommand.createThread({ videoId: video1UUID, text }) + await server.comments.createThread({ videoId: video1UUID, text }) await waitJobs(server) }) @@ -58,11 +58,11 @@ describe('Test update host scripts', function () { // Run server with standard configuration await reRunServer(server) - await server.cliCommand.execWithEnv(`npm run update-host`) + await server.cli.execWithEnv(`npm run update-host`) }) it('Should have updated videos url', async function () { - const { total, data } = await server.videosCommand.list() + const { total, data } = await server.videos.list() expect(total).to.equal(2) for (const video of data) { @@ -70,7 +70,7 @@ describe('Test update host scripts', function () { expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid) - const videoDetails = await server.videosCommand.get({ id: video.uuid }) + const videoDetails = await server.videos.get({ id: video.uuid }) expect(videoDetails.trackerUrls[0]).to.include(server.host) expect(videoDetails.streamingPlaylists[0].playlistUrl).to.include(server.host) @@ -79,7 +79,7 @@ describe('Test update host scripts', function () { }) it('Should have updated video channels url', async function () { - const { data, total } = await server.channelsCommand.list({ sort: '-name' }) + const { data, total } = await server.channels.list({ sort: '-name' }) expect(total).to.equal(3) for (const channel of data) { @@ -90,7 +90,7 @@ describe('Test update host scripts', function () { }) it('Should have updated accounts url', async function () { - const body = await server.accountsCommand.list() + const body = await server.accounts.list() expect(body.total).to.equal(3) for (const account of body.data) { @@ -104,11 +104,11 @@ describe('Test update host scripts', function () { it('Should have updated torrent hosts', async function () { this.timeout(30000) - const { data } = await server.videosCommand.list() + const { data } = await server.videos.list() expect(data).to.have.lengthOf(2) for (const video of data) { - const videoDetails = await server.videosCommand.get({ id: video.id }) + const videoDetails = await server.videos.get({ id: video.id }) expect(videoDetails.files).to.have.lengthOf(4) -- cgit v1.2.3