diff options
Diffstat (limited to 'server/tests/api/search/search-activitypub-videos.ts')
-rw-r--r-- | server/tests/api/search/search-activitypub-videos.ts | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index e8e2b5a64..dbfefadda 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts | |||
@@ -4,18 +4,17 @@ import * as chai from 'chai' | |||
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { | 5 | import { |
6 | addVideoChannel, | 6 | addVideoChannel, |
7 | cleanupTests, | ||
7 | flushAndRunMultipleServers, | 8 | flushAndRunMultipleServers, |
8 | flushTests, | ||
9 | getVideosList, | 9 | getVideosList, |
10 | killallServers, | ||
11 | removeVideo, | 10 | removeVideo, |
11 | searchVideo, | ||
12 | searchVideoWithToken, | 12 | searchVideoWithToken, |
13 | ServerInfo, | 13 | ServerInfo, |
14 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
15 | updateVideo, | 15 | updateVideo, |
16 | uploadVideo, | 16 | uploadVideo, |
17 | wait, | 17 | wait |
18 | searchVideo, cleanupTests | ||
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 | import { Video, VideoPrivacy } from '../../../../shared/models/videos' | 20 | import { Video, VideoPrivacy } from '../../../../shared/models/videos' |
@@ -49,7 +48,8 @@ describe('Test ActivityPub videos search', function () { | |||
49 | 48 | ||
50 | it('Should not find a remote video', async function () { | 49 | it('Should not find a remote video', async function () { |
51 | { | 50 | { |
52 | const res = await searchVideoWithToken(servers[ 0 ].url, 'http://localhost:9002/videos/watch/43', servers[ 0 ].accessToken) | 51 | const search = 'http://localhost:' + servers[1].port + '/videos/watch/43' |
52 | const res = await searchVideoWithToken(servers[ 0 ].url, search, servers[ 0 ].accessToken) | ||
53 | 53 | ||
54 | expect(res.body.total).to.equal(0) | 54 | expect(res.body.total).to.equal(0) |
55 | expect(res.body.data).to.be.an('array') | 55 | expect(res.body.data).to.be.an('array') |
@@ -58,7 +58,8 @@ describe('Test ActivityPub videos search', function () { | |||
58 | 58 | ||
59 | { | 59 | { |
60 | // Without token | 60 | // Without token |
61 | const res = await searchVideo(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID) | 61 | const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID |
62 | const res = await searchVideo(servers[0].url, search) | ||
62 | 63 | ||
63 | expect(res.body.total).to.equal(0) | 64 | expect(res.body.total).to.equal(0) |
64 | expect(res.body.data).to.be.an('array') | 65 | expect(res.body.data).to.be.an('array') |
@@ -67,7 +68,8 @@ describe('Test ActivityPub videos search', function () { | |||
67 | }) | 68 | }) |
68 | 69 | ||
69 | it('Should search a local video', async function () { | 70 | it('Should search a local video', async function () { |
70 | const res = await searchVideo(servers[0].url, 'http://localhost:9001/videos/watch/' + videoServer1UUID) | 71 | const search = 'http://localhost:' + servers[0].port + '/videos/watch/' + videoServer1UUID |
72 | const res = await searchVideo(servers[0].url, search) | ||
71 | 73 | ||
72 | expect(res.body.total).to.equal(1) | 74 | expect(res.body.total).to.equal(1) |
73 | expect(res.body.data).to.be.an('array') | 75 | expect(res.body.data).to.be.an('array') |
@@ -76,7 +78,8 @@ describe('Test ActivityPub videos search', function () { | |||
76 | }) | 78 | }) |
77 | 79 | ||
78 | it('Should search a remote video', async function () { | 80 | it('Should search a remote video', async function () { |
79 | const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) | 81 | const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID |
82 | const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) | ||
80 | 83 | ||
81 | expect(res.body.total).to.equal(1) | 84 | expect(res.body.total).to.equal(1) |
82 | expect(res.body.data).to.be.an('array') | 85 | expect(res.body.data).to.be.an('array') |
@@ -114,12 +117,13 @@ describe('Test ActivityPub videos search', function () { | |||
114 | await wait(10000) | 117 | await wait(10000) |
115 | 118 | ||
116 | // Will run refresh async | 119 | // Will run refresh async |
117 | await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) | 120 | const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID |
121 | await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) | ||
118 | 122 | ||
119 | // Wait refresh | 123 | // Wait refresh |
120 | await wait(5000) | 124 | await wait(5000) |
121 | 125 | ||
122 | const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) | 126 | const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) |
123 | expect(res.body.total).to.equal(1) | 127 | expect(res.body.total).to.equal(1) |
124 | expect(res.body.data).to.have.lengthOf(1) | 128 | expect(res.body.data).to.have.lengthOf(1) |
125 | 129 | ||
@@ -139,12 +143,13 @@ describe('Test ActivityPub videos search', function () { | |||
139 | await wait(10000) | 143 | await wait(10000) |
140 | 144 | ||
141 | // Will run refresh async | 145 | // Will run refresh async |
142 | await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) | 146 | const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID |
147 | await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) | ||
143 | 148 | ||
144 | // Wait refresh | 149 | // Wait refresh |
145 | await wait(5000) | 150 | await wait(5000) |
146 | 151 | ||
147 | const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) | 152 | const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) |
148 | expect(res.body.total).to.equal(0) | 153 | expect(res.body.total).to.equal(0) |
149 | expect(res.body.data).to.have.lengthOf(0) | 154 | expect(res.body.data).to.have.lengthOf(0) |
150 | }) | 155 | }) |