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 --- .../search/search-activitypub-video-channels.ts | 32 +++++++-------- .../search/search-activitypub-video-playlists.ts | 28 ++++++------- .../tests/api/search/search-activitypub-videos.ts | 14 +++---- server/tests/api/search/search-channels.ts | 6 +-- server/tests/api/search/search-index.ts | 14 +++---- server/tests/api/search/search-playlists.ts | 20 +++++----- server/tests/api/search/search-videos.ts | 46 +++++++++++----------- 7 files changed, 80 insertions(+), 80 deletions(-) (limited to 'server/tests/api/search') diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 75794402d..71e9367e5 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts @@ -30,34 +30,34 @@ describe('Test ActivityPub video channels search', function () { await setAccessTokensToServers(servers) { - await servers[0].usersCommand.create({ username: 'user1_server1', password: 'password' }) + await servers[0].users.create({ username: 'user1_server1', password: 'password' }) const channel = { name: 'channel1_server1', displayName: 'Channel 1 server 1' } - await servers[0].channelsCommand.create({ attributes: channel }) + await servers[0].channels.create({ attributes: channel }) } { const user = { username: 'user1_server2', password: 'password' } - await servers[1].usersCommand.create({ username: user.username, password: user.password }) - userServer2Token = await servers[1].loginCommand.getAccessToken(user) + await servers[1].users.create({ username: user.username, password: user.password }) + userServer2Token = await servers[1].login.getAccessToken(user) const channel = { name: 'channel1_server2', displayName: 'Channel 1 server 2' } - const created = await servers[1].channelsCommand.create({ token: userServer2Token, attributes: channel }) + const created = await servers[1].channels.create({ token: userServer2Token, attributes: channel }) channelIdServer2 = created.id const attributes = { name: 'video 1 server 2', channelId: channelIdServer2 } - const { uuid } = await servers[1].videosCommand.upload({ token: userServer2Token, attributes }) + const { uuid } = await servers[1].videos.upload({ token: userServer2Token, attributes }) videoServer2UUID = uuid } await waitJobs(servers) - command = servers[0].searchCommand + command = servers[0].search }) it('Should not find a remote video channel', async function () { @@ -134,7 +134,7 @@ describe('Test ActivityPub video channels search', function () { }) it('Should not list this remote video channel', async function () { - const body = await servers[0].channelsCommand.list() + const body = await servers[0].channels.list() expect(body.total).to.equal(3) expect(body.data).to.have.lengthOf(3) expect(body.data[0].name).to.equal('channel1_server1') @@ -147,7 +147,7 @@ describe('Test ActivityPub video channels search', function () { await waitJobs(servers) - const { total, data } = await servers[0].videosCommand.listByChannel({ + const { total, data } = await servers[0].videos.listByChannel({ token: null, videoChannelName: 'channel1_server2@localhost:' + servers[1].port }) @@ -156,7 +156,7 @@ describe('Test ActivityPub video channels search', function () { }) it('Should list video channel videos of server 2 with token', async function () { - const { total, data } = await servers[0].videosCommand.listByChannel({ + const { total, data } = await servers[0].videos.listByChannel({ videoChannelName: 'channel1_server2@localhost:' + servers[1].port }) @@ -167,12 +167,12 @@ describe('Test ActivityPub video channels search', function () { it('Should update video channel of server 2, and refresh it on server 1', async function () { this.timeout(60000) - await servers[1].channelsCommand.update({ + await servers[1].channels.update({ token: userServer2Token, channelName: 'channel1_server2', attributes: { displayName: 'channel updated' } }) - await servers[1].usersCommand.updateMe({ token: userServer2Token, displayName: 'user updated' }) + await servers[1].users.updateMe({ token: userServer2Token, displayName: 'user updated' }) await waitJobs(servers) // Expire video channel @@ -193,8 +193,8 @@ describe('Test ActivityPub video channels search', function () { it('Should update and add a video on server 2, and update it on server 1 after a search', async function () { this.timeout(60000) - await servers[1].videosCommand.update({ token: userServer2Token, id: videoServer2UUID, attributes: { name: 'video 1 updated' } }) - await servers[1].videosCommand.upload({ token: userServer2Token, attributes: { name: 'video 2 server 2', channelId: channelIdServer2 } }) + await servers[1].videos.update({ token: userServer2Token, id: videoServer2UUID, attributes: { name: 'video 1 updated' } }) + await servers[1].videos.upload({ token: userServer2Token, attributes: { name: 'video 2 server 2', channelId: channelIdServer2 } }) await waitJobs(servers) @@ -207,7 +207,7 @@ describe('Test ActivityPub video channels search', function () { await waitJobs(servers) const videoChannelName = 'channel1_server2@localhost:' + servers[1].port - const { total, data } = await servers[0].videosCommand.listByChannel({ videoChannelName, sort: '-createdAt' }) + const { total, data } = await servers[0].videos.listByChannel({ videoChannelName, sort: '-createdAt' }) expect(total).to.equal(2) expect(data[0].name).to.equal('video 2 server 2') @@ -217,7 +217,7 @@ describe('Test ActivityPub video channels search', function () { it('Should delete video channel of server 2, and delete it on server 1', async function () { this.timeout(60000) - await servers[1].channelsCommand.delete({ token: userServer2Token, channelName: 'channel1_server2' }) + await servers[1].channels.delete({ token: userServer2Token, channelName: 'channel1_server2' }) await waitJobs(servers) // Expire video diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts index 46105c12c..7c99b954b 100644 --- a/server/tests/api/search/search-activitypub-video-playlists.ts +++ b/server/tests/api/search/search-activitypub-video-playlists.ts @@ -33,40 +33,40 @@ describe('Test ActivityPub playlists search', function () { await setDefaultVideoChannel(servers) { - const video1 = (await servers[0].videosCommand.quickUpload({ name: 'video 1' })).uuid - const video2 = (await servers[0].videosCommand.quickUpload({ name: 'video 2' })).uuid + const video1 = (await servers[0].videos.quickUpload({ name: 'video 1' })).uuid + const video2 = (await servers[0].videos.quickUpload({ name: 'video 2' })).uuid const attributes = { displayName: 'playlist 1 on server 1', privacy: VideoPlaylistPrivacy.PUBLIC, - videoChannelId: servers[0].videoChannel.id + videoChannelId: servers[0].store.channel.id } - const created = await servers[0].playlistsCommand.create({ attributes }) + const created = await servers[0].playlists.create({ attributes }) playlistServer1UUID = created.uuid for (const videoId of [ video1, video2 ]) { - await servers[0].playlistsCommand.addElement({ playlistId: playlistServer1UUID, attributes: { videoId } }) + await servers[0].playlists.addElement({ playlistId: playlistServer1UUID, attributes: { videoId } }) } } { - const videoId = (await servers[1].videosCommand.quickUpload({ name: 'video 1' })).uuid - video2Server2 = (await servers[1].videosCommand.quickUpload({ name: 'video 2' })).uuid + const videoId = (await servers[1].videos.quickUpload({ name: 'video 1' })).uuid + video2Server2 = (await servers[1].videos.quickUpload({ name: 'video 2' })).uuid const attributes = { displayName: 'playlist 1 on server 2', privacy: VideoPlaylistPrivacy.PUBLIC, - videoChannelId: servers[1].videoChannel.id + videoChannelId: servers[1].store.channel.id } - const created = await servers[1].playlistsCommand.create({ attributes }) + const created = await servers[1].playlists.create({ attributes }) playlistServer2UUID = created.uuid - await servers[1].playlistsCommand.addElement({ playlistId: playlistServer2UUID, attributes: { videoId } }) + await servers[1].playlists.addElement({ playlistId: playlistServer2UUID, attributes: { videoId } }) } await waitJobs(servers) - command = servers[0].searchCommand + command = servers[0].search }) it('Should not find a remote playlist', async function () { @@ -139,7 +139,7 @@ describe('Test ActivityPub playlists search', function () { }) it('Should not list this remote playlist', async function () { - const body = await servers[0].playlistsCommand.list({ start: 0, count: 10 }) + const body = await servers[0].playlists.list({ start: 0, count: 10 }) expect(body.total).to.equal(1) expect(body.data).to.have.lengthOf(1) expect(body.data[0].displayName).to.equal('playlist 1 on server 1') @@ -148,7 +148,7 @@ describe('Test ActivityPub playlists search', function () { it('Should update the playlist of server 2, and refresh it on server 1', async function () { this.timeout(60000) - await servers[1].playlistsCommand.addElement({ playlistId: playlistServer2UUID, attributes: { videoId: video2Server2 } }) + await servers[1].playlists.addElement({ playlistId: playlistServer2UUID, attributes: { videoId: video2Server2 } }) await waitJobs(servers) // Expire playlist @@ -172,7 +172,7 @@ describe('Test ActivityPub playlists search', function () { it('Should delete playlist of server 2, and delete it on server 1', async function () { this.timeout(60000) - await servers[1].playlistsCommand.delete({ playlistId: playlistServer2UUID }) + await servers[1].playlists.delete({ playlistId: playlistServer2UUID }) await waitJobs(servers) // Expiration diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index 19b4d5ed8..0dfc63446 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts @@ -30,18 +30,18 @@ describe('Test ActivityPub videos search', function () { await setAccessTokensToServers(servers) { - const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video 1 on server 1' } }) + const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video 1 on server 1' } }) videoServer1UUID = uuid } { - const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video 1 on server 2' } }) + const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video 1 on server 2' } }) videoServer2UUID = uuid } await waitJobs(servers) - command = servers[0].searchCommand + command = servers[0].search }) it('Should not find a remote video', async function () { @@ -105,7 +105,7 @@ describe('Test ActivityPub videos search', function () { }) it('Should not list this remote video', async function () { - const { total, data } = await servers[0].videosCommand.list() + const { total, data } = await servers[0].videos.list() expect(total).to.equal(1) expect(data).to.have.lengthOf(1) expect(data[0].name).to.equal('video 1 on server 1') @@ -118,7 +118,7 @@ describe('Test ActivityPub videos search', function () { name: 'super_channel', displayName: 'super channel' } - const created = await servers[1].channelsCommand.create({ attributes: channelAttributes }) + const created = await servers[1].channels.create({ attributes: channelAttributes }) const videoChannelId = created.id const attributes = { @@ -127,7 +127,7 @@ describe('Test ActivityPub videos search', function () { privacy: VideoPrivacy.UNLISTED, channelId: videoChannelId } - await servers[1].videosCommand.update({ id: videoServer2UUID, attributes }) + await servers[1].videos.update({ id: videoServer2UUID, attributes }) await waitJobs(servers) // Expire video @@ -153,7 +153,7 @@ describe('Test ActivityPub videos search', function () { it('Should delete video of server 2, and delete it on server 1', async function () { this.timeout(120000) - await servers[1].videosCommand.remove({ id: videoServer2UUID }) + await servers[1].videos.remove({ id: videoServer2UUID }) await waitJobs(servers) // Expire video diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts index 4d2104708..7035fbd62 100644 --- a/server/tests/api/search/search-channels.ts +++ b/server/tests/api/search/search-channels.ts @@ -19,15 +19,15 @@ describe('Test channels search', function () { await setAccessTokensToServers([ server ]) { - await server.usersCommand.create({ username: 'user1', password: 'password' }) + await server.users.create({ username: 'user1', password: 'password' }) const channel = { name: 'squall_channel', displayName: 'Squall channel' } - await server.channelsCommand.create({ attributes: channel }) + await server.channels.create({ attributes: channel }) } - command = server.searchCommand + command = server.search }) it('Should make a simple search and not have results', async function () { diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts index d5dc40f60..b54c0da22 100644 --- a/server/tests/api/search/search-index.ts +++ b/server/tests/api/search/search-index.ts @@ -20,9 +20,9 @@ describe('Test videos search', function () { await setAccessTokensToServers([ server ]) - await server.videosCommand.upload({ attributes: { name: localVideoName } }) + await server.videos.upload({ attributes: { name: localVideoName } }) - command = server.searchCommand + command = server.search }) describe('Default search', async function () { @@ -30,7 +30,7 @@ describe('Test videos search', function () { it('Should make a local videos search by default', async function () { this.timeout(10000) - await server.configCommand.updateCustomSubConfig({ + await server.config.updateCustomSubConfig({ newConfig: { search: { searchIndex: { @@ -57,7 +57,7 @@ describe('Test videos search', function () { }) it('Should make an index videos search by default', async function () { - await server.configCommand.updateCustomSubConfig({ + await server.config.updateCustomSubConfig({ newConfig: { search: { searchIndex: { @@ -79,7 +79,7 @@ describe('Test videos search', function () { }) it('Should make an index videos search if local search is disabled', async function () { - await server.configCommand.updateCustomSubConfig({ + await server.config.updateCustomSubConfig({ newConfig: { search: { searchIndex: { @@ -213,7 +213,7 @@ describe('Test videos search', function () { let nsfwUUID: string { - await server.configCommand.updateCustomSubConfig({ + await server.config.updateCustomSubConfig({ newConfig: { instance: { defaultNSFWPolicy: 'display' } } @@ -229,7 +229,7 @@ describe('Test videos search', function () { } { - await server.configCommand.updateCustomSubConfig({ + await server.config.updateCustomSubConfig({ newConfig: { instance: { defaultNSFWPolicy: 'do_not_list' } } diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts index 2e4773ed6..e15128c8e 100644 --- a/server/tests/api/search/search-playlists.ts +++ b/server/tests/api/search/search-playlists.ts @@ -26,40 +26,40 @@ describe('Test playlists search', function () { await setAccessTokensToServers([ server ]) await setDefaultVideoChannel([ server ]) - const videoId = (await server.videosCommand.quickUpload({ name: 'video' })).uuid + const videoId = (await server.videos.quickUpload({ name: 'video' })).uuid { const attributes = { displayName: 'Dr. Kenzo Tenma hospital videos', privacy: VideoPlaylistPrivacy.PUBLIC, - videoChannelId: server.videoChannel.id + videoChannelId: server.store.channel.id } - const created = await server.playlistsCommand.create({ attributes }) + const created = await server.playlists.create({ attributes }) - await server.playlistsCommand.addElement({ playlistId: created.id, attributes: { videoId } }) + await server.playlists.addElement({ playlistId: created.id, attributes: { videoId } }) } { const attributes = { displayName: 'Johan & Anna Libert musics', privacy: VideoPlaylistPrivacy.PUBLIC, - videoChannelId: server.videoChannel.id + videoChannelId: server.store.channel.id } - const created = await server.playlistsCommand.create({ attributes }) + const created = await server.playlists.create({ attributes }) - await server.playlistsCommand.addElement({ playlistId: created.id, attributes: { videoId } }) + await server.playlists.addElement({ playlistId: created.id, attributes: { videoId } }) } { const attributes = { displayName: 'Inspector Lunge playlist', privacy: VideoPlaylistPrivacy.PUBLIC, - videoChannelId: server.videoChannel.id + videoChannelId: server.store.channel.id } - await server.playlistsCommand.create({ attributes }) + await server.playlists.create({ attributes }) } - command = server.searchCommand + command = server.search }) it('Should make a simple search and not have results', async function () { diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 148499d5f..478ebafc9 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts @@ -40,24 +40,24 @@ describe('Test videos search', function () { nsfw: false, language: 'fr' } - await server.videosCommand.upload({ attributes: attributes1 }) + await server.videos.upload({ attributes: attributes1 }) const attributes2 = { ...attributes1, name: attributes1.name + ' - 2', fixture: 'video_short.mp4' } - await server.videosCommand.upload({ attributes: attributes2 }) + await server.videos.upload({ attributes: attributes2 }) { const attributes3 = { ...attributes1, name: attributes1.name + ' - 3', language: undefined } - const { id, uuid } = await server.videosCommand.upload({ attributes: attributes3 }) + const { id, uuid } = await server.videos.upload({ attributes: attributes3 }) videoUUID = uuid - await server.captionsCommand.createVideoCaption({ + await server.captions.createVideoCaption({ language: 'en', videoId: id, fixture: 'subtitle-good2.vtt', mimeType: 'application/octet-stream' }) - await server.captionsCommand.createVideoCaption({ + await server.captions.createVideoCaption({ language: 'aa', videoId: id, fixture: 'subtitle-good2.vtt', @@ -66,23 +66,23 @@ describe('Test videos search', function () { } const attributes4 = { ...attributes1, name: attributes1.name + ' - 4', language: 'pl', nsfw: true } - await server.videosCommand.upload({ attributes: attributes4 }) + await server.videos.upload({ attributes: attributes4 }) await wait(1000) startDate = new Date().toISOString() const attributes5 = { ...attributes1, name: attributes1.name + ' - 5', licence: 2, language: undefined } - await server.videosCommand.upload({ attributes: attributes5 }) + await server.videos.upload({ attributes: attributes5 }) const attributes6 = { ...attributes1, name: attributes1.name + ' - 6', tags: [ 't1', 't2' ] } - await server.videosCommand.upload({ attributes: attributes6 }) + await server.videos.upload({ attributes: attributes6 }) const attributes7 = { ...attributes1, name: attributes1.name + ' - 7', originallyPublishedAt: '2019-02-12T09:58:08.286Z' } - await server.videosCommand.upload({ attributes: attributes7 }) + await server.videos.upload({ attributes: attributes7 }) const attributes8 = { ...attributes1, name: attributes1.name + ' - 8', licence: 4 } - await server.videosCommand.upload({ attributes: attributes8 }) + await server.videos.upload({ attributes: attributes8 }) } { @@ -93,9 +93,9 @@ describe('Test videos search', function () { licence: 2, language: 'en' } - await server.videosCommand.upload({ attributes: attributes }) + await server.videos.upload({ attributes: attributes }) - await server.videosCommand.upload({ attributes: { ...attributes, name: attributes.name + ' duplicate' } }) + await server.videos.upload({ attributes: { ...attributes, name: attributes.name + ' duplicate' } }) } { @@ -106,7 +106,7 @@ describe('Test videos search', function () { licence: 3, language: 'pl' } - await server.videosCommand.upload({ attributes: attributes }) + await server.videos.upload({ attributes: attributes }) } { @@ -115,11 +115,11 @@ describe('Test videos search', function () { tags: [ 'aaaa', 'bbbb', 'cccc' ], category: 1 } - await server.videosCommand.upload({ attributes: attributes1 }) - await server.videosCommand.upload({ attributes: { ...attributes1, category: 2 } }) + await server.videos.upload({ attributes: attributes1 }) + await server.videos.upload({ attributes: { ...attributes1, category: 2 } }) - await server.videosCommand.upload({ attributes: { ...attributes1, tags: [ 'cccc', 'dddd' ] } }) - await server.videosCommand.upload({ attributes: { ...attributes1, tags: [ 'eeee', 'ffff' ] } }) + await server.videos.upload({ attributes: { ...attributes1, tags: [ 'cccc', 'dddd' ] } }) + await server.videos.upload({ attributes: { ...attributes1, tags: [ 'eeee', 'ffff' ] } }) } { @@ -127,11 +127,11 @@ describe('Test videos search', function () { name: 'aaaa 2', category: 1 } - await server.videosCommand.upload({ attributes: attributes1 }) - await server.videosCommand.upload({ attributes: { ...attributes1, category: 2 } }) + await server.videos.upload({ attributes: attributes1 }) + await server.videos.upload({ attributes: { ...attributes1, category: 2 } }) } - command = server.searchCommand + command = server.search }) it('Should make a simple search and not have results', async function () { @@ -479,7 +479,7 @@ describe('Test videos search', function () { }, live: { enabled: true } } - await server.configCommand.updateCustomSubConfig({ newConfig }) + await server.config.updateCustomSubConfig({ newConfig }) } { @@ -490,9 +490,9 @@ describe('Test videos search', function () { } { - const liveCommand = server.liveCommand + const liveCommand = server.live - const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id } + const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.store.channel.id } const live = await liveCommand.create({ fields: liveAttributes }) const ffmpegCommand = await liveCommand.sendRTMPStreamInVideo({ videoId: live.id }) -- cgit v1.2.3