diff options
Diffstat (limited to 'server/tests/api/search')
-rw-r--r-- | server/tests/api/search/search-activitypub-video-channels.ts | 30 | ||||
-rw-r--r-- | server/tests/api/search/search-activitypub-videos.ts | 5 | ||||
-rw-r--r-- | server/tests/api/search/search-channels.ts | 12 |
3 files changed, 19 insertions, 28 deletions
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index cf5158b66..83be9cd1e 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts | |||
@@ -3,19 +3,15 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | addVideoChannel, | ||
7 | cleanupTests, | 6 | cleanupTests, |
8 | createUser, | 7 | createUser, |
9 | deleteVideoChannel, | ||
10 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
11 | getVideoChannelsList, | ||
12 | getVideoChannelVideos, | 9 | getVideoChannelVideos, |
13 | SearchCommand, | 10 | SearchCommand, |
14 | ServerInfo, | 11 | ServerInfo, |
15 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
16 | updateMyUser, | 13 | updateMyUser, |
17 | updateVideo, | 14 | updateVideo, |
18 | updateVideoChannel, | ||
19 | uploadVideo, | 15 | uploadVideo, |
20 | userLogin, | 16 | userLogin, |
21 | wait, | 17 | wait, |
@@ -45,7 +41,7 @@ describe('Test ActivityPub video channels search', function () { | |||
45 | name: 'channel1_server1', | 41 | name: 'channel1_server1', |
46 | displayName: 'Channel 1 server 1' | 42 | displayName: 'Channel 1 server 1' |
47 | } | 43 | } |
48 | await addVideoChannel(servers[0].url, servers[0].accessToken, channel) | 44 | await servers[0].channelsCommand.create({ attributes: channel }) |
49 | } | 45 | } |
50 | 46 | ||
51 | { | 47 | { |
@@ -57,8 +53,8 @@ describe('Test ActivityPub video channels search', function () { | |||
57 | name: 'channel1_server2', | 53 | name: 'channel1_server2', |
58 | displayName: 'Channel 1 server 2' | 54 | displayName: 'Channel 1 server 2' |
59 | } | 55 | } |
60 | const resChannel = await addVideoChannel(servers[1].url, userServer2Token, channel) | 56 | const created = await servers[1].channelsCommand.create({ token: userServer2Token, attributes: channel }) |
61 | channelIdServer2 = resChannel.body.videoChannel.id | 57 | channelIdServer2 = created.id |
62 | 58 | ||
63 | const res = await uploadVideo(servers[1].url, userServer2Token, { name: 'video 1 server 2', channelId: channelIdServer2 }) | 59 | const res = await uploadVideo(servers[1].url, userServer2Token, { name: 'video 1 server 2', channelId: channelIdServer2 }) |
64 | videoServer2UUID = res.body.video.uuid | 60 | videoServer2UUID = res.body.video.uuid |
@@ -143,12 +139,12 @@ describe('Test ActivityPub video channels search', function () { | |||
143 | }) | 139 | }) |
144 | 140 | ||
145 | it('Should not list this remote video channel', async function () { | 141 | it('Should not list this remote video channel', async function () { |
146 | const res = await getVideoChannelsList(servers[0].url, 0, 5) | 142 | const body = await servers[0].channelsCommand.list() |
147 | expect(res.body.total).to.equal(3) | 143 | expect(body.total).to.equal(3) |
148 | expect(res.body.data).to.have.lengthOf(3) | 144 | expect(body.data).to.have.lengthOf(3) |
149 | expect(res.body.data[0].name).to.equal('channel1_server1') | 145 | expect(body.data[0].name).to.equal('channel1_server1') |
150 | expect(res.body.data[1].name).to.equal('user1_server1_channel') | 146 | expect(body.data[1].name).to.equal('user1_server1_channel') |
151 | expect(res.body.data[2].name).to.equal('root_channel') | 147 | expect(body.data[2].name).to.equal('root_channel') |
152 | }) | 148 | }) |
153 | 149 | ||
154 | it('Should list video channel videos of server 2 without token', async function () { | 150 | it('Should list video channel videos of server 2 without token', async function () { |
@@ -171,7 +167,11 @@ describe('Test ActivityPub video channels search', function () { | |||
171 | it('Should update video channel of server 2, and refresh it on server 1', async function () { | 167 | it('Should update video channel of server 2, and refresh it on server 1', async function () { |
172 | this.timeout(60000) | 168 | this.timeout(60000) |
173 | 169 | ||
174 | await updateVideoChannel(servers[1].url, userServer2Token, 'channel1_server2', { displayName: 'channel updated' }) | 170 | await servers[1].channelsCommand.update({ |
171 | token: userServer2Token, | ||
172 | channelName: 'channel1_server2', | ||
173 | attributes: { displayName: 'channel updated' } | ||
174 | }) | ||
175 | await updateMyUser({ url: servers[1].url, accessToken: userServer2Token, displayName: 'user updated' }) | 175 | await updateMyUser({ url: servers[1].url, accessToken: userServer2Token, displayName: 'user updated' }) |
176 | 176 | ||
177 | await waitJobs(servers) | 177 | await waitJobs(servers) |
@@ -217,7 +217,7 @@ describe('Test ActivityPub video channels search', function () { | |||
217 | it('Should delete video channel of server 2, and delete it on server 1', async function () { | 217 | it('Should delete video channel of server 2, and delete it on server 1', async function () { |
218 | this.timeout(60000) | 218 | this.timeout(60000) |
219 | 219 | ||
220 | await deleteVideoChannel(servers[1].url, userServer2Token, 'channel1_server2') | 220 | await servers[1].channelsCommand.delete({ token: userServer2Token, channelName: 'channel1_server2' }) |
221 | 221 | ||
222 | await waitJobs(servers) | 222 | await waitJobs(servers) |
223 | // Expire video | 223 | // Expire video |
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index 7c6455258..403c84010 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts | |||
@@ -3,7 +3,6 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | addVideoChannel, | ||
7 | cleanupTests, | 6 | cleanupTests, |
8 | flushAndRunMultipleServers, | 7 | flushAndRunMultipleServers, |
9 | getVideosList, | 8 | getVideosList, |
@@ -123,8 +122,8 @@ describe('Test ActivityPub videos search', function () { | |||
123 | name: 'super_channel', | 122 | name: 'super_channel', |
124 | displayName: 'super channel' | 123 | displayName: 'super channel' |
125 | } | 124 | } |
126 | const resChannel = await addVideoChannel(servers[1].url, servers[1].accessToken, channelAttributes) | 125 | const created = await servers[1].channelsCommand.create({ attributes: channelAttributes }) |
127 | const videoChannelId = resChannel.body.videoChannel.id | 126 | const videoChannelId = created.id |
128 | 127 | ||
129 | const attributes = { | 128 | const attributes = { |
130 | name: 'updated', | 129 | name: 'updated', |
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts index 307bc063d..6c9ee73ce 100644 --- a/server/tests/api/search/search-channels.ts +++ b/server/tests/api/search/search-channels.ts | |||
@@ -2,15 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { cleanupTests, createUser, flushAndRunServer, SearchCommand, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' |
6 | addVideoChannel, | ||
7 | cleanupTests, | ||
8 | createUser, | ||
9 | flushAndRunServer, | ||
10 | SearchCommand, | ||
11 | ServerInfo, | ||
12 | setAccessTokensToServers | ||
13 | } from '@shared/extra-utils' | ||
14 | import { VideoChannel } from '@shared/models' | 6 | import { VideoChannel } from '@shared/models' |
15 | 7 | ||
16 | const expect = chai.expect | 8 | const expect = chai.expect |
@@ -32,7 +24,7 @@ describe('Test channels search', function () { | |||
32 | name: 'squall_channel', | 24 | name: 'squall_channel', |
33 | displayName: 'Squall channel' | 25 | displayName: 'Squall channel' |
34 | } | 26 | } |
35 | await addVideoChannel(server.url, server.accessToken, channel) | 27 | await server.channelsCommand.create({ attributes: channel }) |
36 | } | 28 | } |
37 | 29 | ||
38 | command = server.searchCommand | 30 | command = server.searchCommand |