aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/api/search
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/api/search')
-rw-r--r--server/tests/api/search/search-index.ts55
-rw-r--r--server/tests/api/search/search-videos.ts5
2 files changed, 36 insertions, 24 deletions
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index b2c0857a7..e4c5f5796 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -9,7 +9,6 @@ import {
9 SearchCommand, 9 SearchCommand,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 updateCustomSubConfig,
13 uploadVideo 12 uploadVideo
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' 14import { VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
@@ -39,12 +38,14 @@ describe('Test videos search', function () {
39 it('Should make a local videos search by default', async function () { 38 it('Should make a local videos search by default', async function () {
40 this.timeout(10000) 39 this.timeout(10000)
41 40
42 await updateCustomSubConfig(server.url, server.accessToken, { 41 await server.configCommand.updateCustomSubConfig({
43 search: { 42 newConfig: {
44 searchIndex: { 43 search: {
45 enabled: true, 44 searchIndex: {
46 isDefaultSearch: false, 45 enabled: true,
47 disableLocalSearch: false 46 isDefaultSearch: false,
47 disableLocalSearch: false
48 }
48 } 49 }
49 } 50 }
50 }) 51 })
@@ -64,12 +65,14 @@ describe('Test videos search', function () {
64 }) 65 })
65 66
66 it('Should make an index videos search by default', async function () { 67 it('Should make an index videos search by default', async function () {
67 await updateCustomSubConfig(server.url, server.accessToken, { 68 await server.configCommand.updateCustomSubConfig({
68 search: { 69 newConfig: {
69 searchIndex: { 70 search: {
70 enabled: true, 71 searchIndex: {
71 isDefaultSearch: true, 72 enabled: true,
72 disableLocalSearch: false 73 isDefaultSearch: true,
74 disableLocalSearch: false
75 }
73 } 76 }
74 } 77 }
75 }) 78 })
@@ -84,12 +87,14 @@ describe('Test videos search', function () {
84 }) 87 })
85 88
86 it('Should make an index videos search if local search is disabled', async function () { 89 it('Should make an index videos search if local search is disabled', async function () {
87 await updateCustomSubConfig(server.url, server.accessToken, { 90 await server.configCommand.updateCustomSubConfig({
88 search: { 91 newConfig: {
89 searchIndex: { 92 search: {
90 enabled: true, 93 searchIndex: {
91 isDefaultSearch: false, 94 enabled: true,
92 disableLocalSearch: true 95 isDefaultSearch: false,
96 disableLocalSearch: true
97 }
93 } 98 }
94 } 99 }
95 }) 100 })
@@ -216,7 +221,11 @@ describe('Test videos search', function () {
216 let nsfwUUID: string 221 let nsfwUUID: string
217 222
218 { 223 {
219 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } }) 224 await server.configCommand.updateCustomSubConfig({
225 newConfig: {
226 instance: { defaultNSFWPolicy: 'display' }
227 }
228 })
220 229
221 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) 230 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' })
222 expect(body.data).to.have.length.greaterThan(0) 231 expect(body.data).to.have.length.greaterThan(0)
@@ -228,7 +237,11 @@ describe('Test videos search', function () {
228 } 237 }
229 238
230 { 239 {
231 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } }) 240 await server.configCommand.updateCustomSubConfig({
241 newConfig: {
242 instance: { defaultNSFWPolicy: 'do_not_list' }
243 }
244 })
232 245
233 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) 246 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' })
234 247
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index f0482c7e0..7dc89c447 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -14,7 +14,6 @@ import {
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 setDefaultVideoChannel, 15 setDefaultVideoChannel,
16 stopFfmpeg, 16 stopFfmpeg,
17 updateCustomSubConfig,
18 uploadVideo, 17 uploadVideo,
19 wait, 18 wait,
20 waitUntilLivePublished 19 waitUntilLivePublished
@@ -486,13 +485,13 @@ describe('Test videos search', function () {
486 this.timeout(30000) 485 this.timeout(30000)
487 486
488 { 487 {
489 const options = { 488 const newConfig = {
490 search: { 489 search: {
491 searchIndex: { enabled: false } 490 searchIndex: { enabled: false }
492 }, 491 },
493 live: { enabled: true } 492 live: { enabled: true }
494 } 493 }
495 await updateCustomSubConfig(server.url, server.accessToken, options) 494 await server.configCommand.updateCustomSubConfig({ newConfig })
496 } 495 }
497 496
498 { 497 {