diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-15 10:02:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch) | |
tree | da82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tests/api/search/search-activitypub-videos.ts | |
parent | 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff) | |
download | PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip |
Introduce videos command
Diffstat (limited to 'server/tests/api/search/search-activitypub-videos.ts')
-rw-r--r-- | server/tests/api/search/search-activitypub-videos.ts | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index 403c84010..19b4d5ed8 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts | |||
@@ -5,17 +5,13 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | flushAndRunMultipleServers, | 7 | flushAndRunMultipleServers, |
8 | getVideosList, | ||
9 | removeVideo, | ||
10 | SearchCommand, | 8 | SearchCommand, |
11 | ServerInfo, | 9 | ServerInfo, |
12 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
13 | updateVideo, | 11 | wait, |
14 | uploadVideo, | 12 | waitJobs |
15 | wait | 13 | } from '@shared/extra-utils' |
16 | } from '../../../../shared/extra-utils' | 14 | import { VideoPrivacy } from '@shared/models' |
17 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | ||
18 | import { VideoPrivacy } from '../../../../shared/models/videos' | ||
19 | 15 | ||
20 | const expect = chai.expect | 16 | const expect = chai.expect |
21 | 17 | ||
@@ -34,13 +30,13 @@ describe('Test ActivityPub videos search', function () { | |||
34 | await setAccessTokensToServers(servers) | 30 | await setAccessTokensToServers(servers) |
35 | 31 | ||
36 | { | 32 | { |
37 | const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 1 on server 1' }) | 33 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video 1 on server 1' } }) |
38 | videoServer1UUID = res.body.video.uuid | 34 | videoServer1UUID = uuid |
39 | } | 35 | } |
40 | 36 | ||
41 | { | 37 | { |
42 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 on server 2' }) | 38 | const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video 1 on server 2' } }) |
43 | videoServer2UUID = res.body.video.uuid | 39 | videoServer2UUID = uuid |
44 | } | 40 | } |
45 | 41 | ||
46 | await waitJobs(servers) | 42 | await waitJobs(servers) |
@@ -109,10 +105,10 @@ describe('Test ActivityPub videos search', function () { | |||
109 | }) | 105 | }) |
110 | 106 | ||
111 | it('Should not list this remote video', async function () { | 107 | it('Should not list this remote video', async function () { |
112 | const res = await getVideosList(servers[0].url) | 108 | const { total, data } = await servers[0].videosCommand.list() |
113 | expect(res.body.total).to.equal(1) | 109 | expect(total).to.equal(1) |
114 | expect(res.body.data).to.have.lengthOf(1) | 110 | expect(data).to.have.lengthOf(1) |
115 | expect(res.body.data[0].name).to.equal('video 1 on server 1') | 111 | expect(data[0].name).to.equal('video 1 on server 1') |
116 | }) | 112 | }) |
117 | 113 | ||
118 | it('Should update video of server 2, and refresh it on server 1', async function () { | 114 | it('Should update video of server 2, and refresh it on server 1', async function () { |
@@ -131,7 +127,7 @@ describe('Test ActivityPub videos search', function () { | |||
131 | privacy: VideoPrivacy.UNLISTED, | 127 | privacy: VideoPrivacy.UNLISTED, |
132 | channelId: videoChannelId | 128 | channelId: videoChannelId |
133 | } | 129 | } |
134 | await updateVideo(servers[1].url, servers[1].accessToken, videoServer2UUID, attributes) | 130 | await servers[1].videosCommand.update({ id: videoServer2UUID, attributes }) |
135 | 131 | ||
136 | await waitJobs(servers) | 132 | await waitJobs(servers) |
137 | // Expire video | 133 | // Expire video |
@@ -157,7 +153,7 @@ describe('Test ActivityPub videos search', function () { | |||
157 | it('Should delete video of server 2, and delete it on server 1', async function () { | 153 | it('Should delete video of server 2, and delete it on server 1', async function () { |
158 | this.timeout(120000) | 154 | this.timeout(120000) |
159 | 155 | ||
160 | await removeVideo(servers[1].url, servers[1].accessToken, videoServer2UUID) | 156 | await servers[1].videosCommand.remove({ id: videoServer2UUID }) |
161 | 157 | ||
162 | await waitJobs(servers) | 158 | await waitJobs(servers) |
163 | // Expire video | 159 | // Expire video |