aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/search/search-videos.ts')
-rw-r--r--server/tests/api/search/search-videos.ts42
1 files changed, 20 insertions, 22 deletions
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index 66f5f3182..148499d5f 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -10,7 +10,6 @@ import {
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
12 stopFfmpeg, 12 stopFfmpeg,
13 uploadVideo,
14 wait 13 wait
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { VideoPrivacy } from '@shared/models' 15import { VideoPrivacy } from '@shared/models'
@@ -41,50 +40,49 @@ describe('Test videos search', function () {
41 nsfw: false, 40 nsfw: false,
42 language: 'fr' 41 language: 'fr'
43 } 42 }
44 await uploadVideo(server.url, server.accessToken, attributes1) 43 await server.videosCommand.upload({ attributes: attributes1 })
45 44
46 const attributes2 = { ...attributes1, name: attributes1.name + ' - 2', fixture: 'video_short.mp4' } 45 const attributes2 = { ...attributes1, name: attributes1.name + ' - 2', fixture: 'video_short.mp4' }
47 await uploadVideo(server.url, server.accessToken, attributes2) 46 await server.videosCommand.upload({ attributes: attributes2 })
48 47
49 { 48 {
50 const attributes3 = { ...attributes1, name: attributes1.name + ' - 3', language: undefined } 49 const attributes3 = { ...attributes1, name: attributes1.name + ' - 3', language: undefined }
51 const res = await uploadVideo(server.url, server.accessToken, attributes3) 50 const { id, uuid } = await server.videosCommand.upload({ attributes: attributes3 })
52 const videoId = res.body.video.id 51 videoUUID = uuid
53 videoUUID = res.body.video.uuid
54 52
55 await server.captionsCommand.createVideoCaption({ 53 await server.captionsCommand.createVideoCaption({
56 language: 'en', 54 language: 'en',
57 videoId, 55 videoId: id,
58 fixture: 'subtitle-good2.vtt', 56 fixture: 'subtitle-good2.vtt',
59 mimeType: 'application/octet-stream' 57 mimeType: 'application/octet-stream'
60 }) 58 })
61 59
62 await server.captionsCommand.createVideoCaption({ 60 await server.captionsCommand.createVideoCaption({
63 language: 'aa', 61 language: 'aa',
64 videoId, 62 videoId: id,
65 fixture: 'subtitle-good2.vtt', 63 fixture: 'subtitle-good2.vtt',
66 mimeType: 'application/octet-stream' 64 mimeType: 'application/octet-stream'
67 }) 65 })
68 } 66 }
69 67
70 const attributes4 = { ...attributes1, name: attributes1.name + ' - 4', language: 'pl', nsfw: true } 68 const attributes4 = { ...attributes1, name: attributes1.name + ' - 4', language: 'pl', nsfw: true }
71 await uploadVideo(server.url, server.accessToken, attributes4) 69 await server.videosCommand.upload({ attributes: attributes4 })
72 70
73 await wait(1000) 71 await wait(1000)
74 72
75 startDate = new Date().toISOString() 73 startDate = new Date().toISOString()
76 74
77 const attributes5 = { ...attributes1, name: attributes1.name + ' - 5', licence: 2, language: undefined } 75 const attributes5 = { ...attributes1, name: attributes1.name + ' - 5', licence: 2, language: undefined }
78 await uploadVideo(server.url, server.accessToken, attributes5) 76 await server.videosCommand.upload({ attributes: attributes5 })
79 77
80 const attributes6 = { ...attributes1, name: attributes1.name + ' - 6', tags: [ 't1', 't2' ] } 78 const attributes6 = { ...attributes1, name: attributes1.name + ' - 6', tags: [ 't1', 't2' ] }
81 await uploadVideo(server.url, server.accessToken, attributes6) 79 await server.videosCommand.upload({ attributes: attributes6 })
82 80
83 const attributes7 = { ...attributes1, name: attributes1.name + ' - 7', originallyPublishedAt: '2019-02-12T09:58:08.286Z' } 81 const attributes7 = { ...attributes1, name: attributes1.name + ' - 7', originallyPublishedAt: '2019-02-12T09:58:08.286Z' }
84 await uploadVideo(server.url, server.accessToken, attributes7) 82 await server.videosCommand.upload({ attributes: attributes7 })
85 83
86 const attributes8 = { ...attributes1, name: attributes1.name + ' - 8', licence: 4 } 84 const attributes8 = { ...attributes1, name: attributes1.name + ' - 8', licence: 4 }
87 await uploadVideo(server.url, server.accessToken, attributes8) 85 await server.videosCommand.upload({ attributes: attributes8 })
88 } 86 }
89 87
90 { 88 {
@@ -95,9 +93,9 @@ describe('Test videos search', function () {
95 licence: 2, 93 licence: 2,
96 language: 'en' 94 language: 'en'
97 } 95 }
98 await uploadVideo(server.url, server.accessToken, attributes) 96 await server.videosCommand.upload({ attributes: attributes })
99 97
100 await uploadVideo(server.url, server.accessToken, { ...attributes, name: attributes.name + ' duplicate' }) 98 await server.videosCommand.upload({ attributes: { ...attributes, name: attributes.name + ' duplicate' } })
101 } 99 }
102 100
103 { 101 {
@@ -108,7 +106,7 @@ describe('Test videos search', function () {
108 licence: 3, 106 licence: 3,
109 language: 'pl' 107 language: 'pl'
110 } 108 }
111 await uploadVideo(server.url, server.accessToken, attributes) 109 await server.videosCommand.upload({ attributes: attributes })
112 } 110 }
113 111
114 { 112 {
@@ -117,11 +115,11 @@ describe('Test videos search', function () {
117 tags: [ 'aaaa', 'bbbb', 'cccc' ], 115 tags: [ 'aaaa', 'bbbb', 'cccc' ],
118 category: 1 116 category: 1
119 } 117 }
120 await uploadVideo(server.url, server.accessToken, attributes1) 118 await server.videosCommand.upload({ attributes: attributes1 })
121 await uploadVideo(server.url, server.accessToken, { ...attributes1, category: 2 }) 119 await server.videosCommand.upload({ attributes: { ...attributes1, category: 2 } })
122 120
123 await uploadVideo(server.url, server.accessToken, { ...attributes1, tags: [ 'cccc', 'dddd' ] }) 121 await server.videosCommand.upload({ attributes: { ...attributes1, tags: [ 'cccc', 'dddd' ] } })
124 await uploadVideo(server.url, server.accessToken, { ...attributes1, tags: [ 'eeee', 'ffff' ] }) 122 await server.videosCommand.upload({ attributes: { ...attributes1, tags: [ 'eeee', 'ffff' ] } })
125 } 123 }
126 124
127 { 125 {
@@ -129,8 +127,8 @@ describe('Test videos search', function () {
129 name: 'aaaa 2', 127 name: 'aaaa 2',
130 category: 1 128 category: 1
131 } 129 }
132 await uploadVideo(server.url, server.accessToken, attributes1) 130 await server.videosCommand.upload({ attributes: attributes1 })
133 await uploadVideo(server.url, server.accessToken, { ...attributes1, category: 2 }) 131 await server.videosCommand.upload({ attributes: { ...attributes1, category: 2 } })
134 } 132 }
135 133
136 command = server.searchCommand 134 command = server.searchCommand