diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/index.ts | 1 | ||||
-rw-r--r-- | server/tests/api/check-params/search.ts | 122 | ||||
-rw-r--r-- | server/tests/api/index-fast.ts | 1 | ||||
-rw-r--r-- | server/tests/api/search/search-videos.ts | 299 | ||||
-rw-r--r-- | server/tests/api/videos/single-server.ts | 153 | ||||
-rw-r--r-- | server/tests/api/videos/video-nsfw.ts | 30 | ||||
-rw-r--r-- | server/tests/utils/index.ts | 1 | ||||
-rw-r--r-- | server/tests/utils/requests/check-api-params.ts | 13 | ||||
-rw-r--r-- | server/tests/utils/search/videos.ts | 77 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 86 |
10 files changed, 570 insertions, 213 deletions
diff --git a/server/tests/api/check-params/index.ts b/server/tests/api/check-params/index.ts index c0e0302df..820dde889 100644 --- a/server/tests/api/check-params/index.ts +++ b/server/tests/api/check-params/index.ts | |||
@@ -10,3 +10,4 @@ import './video-captions' | |||
10 | import './video-channels' | 10 | import './video-channels' |
11 | import './video-comments' | 11 | import './video-comments' |
12 | import './videos' | 12 | import './videos' |
13 | import './search' | ||
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts new file mode 100644 index 000000000..d35eac7fe --- /dev/null +++ b/server/tests/api/check-params/search.ts | |||
@@ -0,0 +1,122 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
3 | import 'mocha' | ||
4 | |||
5 | import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../utils' | ||
6 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' | ||
7 | |||
8 | describe('Test videos API validator', function () { | ||
9 | const path = '/api/v1/search/videos/' | ||
10 | let server: ServerInfo | ||
11 | |||
12 | // --------------------------------------------------------------- | ||
13 | |||
14 | before(async function () { | ||
15 | this.timeout(30000) | ||
16 | |||
17 | await flushTests() | ||
18 | |||
19 | server = await runServer(1) | ||
20 | }) | ||
21 | |||
22 | describe('When searching videos', function () { | ||
23 | const query = { | ||
24 | search: 'coucou' | ||
25 | } | ||
26 | |||
27 | it('Should fail with a bad start pagination', async function () { | ||
28 | await checkBadStartPagination(server.url, path, null, query) | ||
29 | }) | ||
30 | |||
31 | it('Should fail with a bad count pagination', async function () { | ||
32 | await checkBadCountPagination(server.url, path, null, query) | ||
33 | }) | ||
34 | |||
35 | it('Should fail with an incorrect sort', async function () { | ||
36 | await checkBadSortPagination(server.url, path, null, query) | ||
37 | }) | ||
38 | |||
39 | it('Should success with the correct parameters', async function () { | ||
40 | await makeGetRequest({ url: server.url, path, query, statusCodeExpected: 200 }) | ||
41 | }) | ||
42 | |||
43 | it('Should fail with an invalid category', async function () { | ||
44 | const customQuery1 = immutableAssign(query, { categoryOneOf: [ 'aa', 'b' ] }) | ||
45 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 400 }) | ||
46 | |||
47 | const customQuery2 = immutableAssign(query, { categoryOneOf: 'a' }) | ||
48 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 400 }) | ||
49 | }) | ||
50 | |||
51 | it('Should succeed with a valid category', async function () { | ||
52 | const customQuery1 = immutableAssign(query, { categoryOneOf: [ 1, 7 ] }) | ||
53 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 200 }) | ||
54 | |||
55 | const customQuery2 = immutableAssign(query, { categoryOneOf: 1 }) | ||
56 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 200 }) | ||
57 | }) | ||
58 | |||
59 | it('Should fail with an invalid licence', async function () { | ||
60 | const customQuery1 = immutableAssign(query, { licenceOneOf: [ 'aa', 'b' ] }) | ||
61 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 400 }) | ||
62 | |||
63 | const customQuery2 = immutableAssign(query, { licenceOneOf: 'a' }) | ||
64 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 400 }) | ||
65 | }) | ||
66 | |||
67 | it('Should succeed with a valid licence', async function () { | ||
68 | const customQuery1 = immutableAssign(query, { licenceOneOf: [ 1, 2 ] }) | ||
69 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 200 }) | ||
70 | |||
71 | const customQuery2 = immutableAssign(query, { licenceOneOf: 1 }) | ||
72 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 200 }) | ||
73 | }) | ||
74 | |||
75 | it('Should succeed with a valid language', async function () { | ||
76 | const customQuery1 = immutableAssign(query, { languageOneOf: [ 'fr', 'en' ] }) | ||
77 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 200 }) | ||
78 | |||
79 | const customQuery2 = immutableAssign(query, { languageOneOf: 'fr' }) | ||
80 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 200 }) | ||
81 | }) | ||
82 | |||
83 | it('Should succeed with valid tags', async function () { | ||
84 | const customQuery1 = immutableAssign(query, { tagsOneOf: [ 'tag1', 'tag2' ] }) | ||
85 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 200 }) | ||
86 | |||
87 | const customQuery2 = immutableAssign(query, { tagsOneOf: 'tag1' }) | ||
88 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 200 }) | ||
89 | |||
90 | const customQuery3 = immutableAssign(query, { tagsAllOf: [ 'tag1', 'tag2' ] }) | ||
91 | await makeGetRequest({ url: server.url, path, query: customQuery3, statusCodeExpected: 200 }) | ||
92 | |||
93 | const customQuery4 = immutableAssign(query, { tagsAllOf: 'tag1' }) | ||
94 | await makeGetRequest({ url: server.url, path, query: customQuery4, statusCodeExpected: 200 }) | ||
95 | }) | ||
96 | |||
97 | it('Should fail with invalid durations', async function () { | ||
98 | const customQuery1 = immutableAssign(query, { durationMin: 'hello' }) | ||
99 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 400 }) | ||
100 | |||
101 | const customQuery2 = immutableAssign(query, { durationMax: 'hello' }) | ||
102 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 400 }) | ||
103 | }) | ||
104 | |||
105 | it('Should fail with invalid dates', async function () { | ||
106 | const customQuery1 = immutableAssign(query, { startDate: 'hello' }) | ||
107 | await makeGetRequest({ url: server.url, path, query: customQuery1, statusCodeExpected: 400 }) | ||
108 | |||
109 | const customQuery2 = immutableAssign(query, { endDate: 'hello' }) | ||
110 | await makeGetRequest({ url: server.url, path, query: customQuery2, statusCodeExpected: 400 }) | ||
111 | }) | ||
112 | }) | ||
113 | |||
114 | after(async function () { | ||
115 | killallServers([ server ]) | ||
116 | |||
117 | // Keep the logs if the test failed | ||
118 | if (this['ok']) { | ||
119 | await flushTests() | ||
120 | } | ||
121 | }) | ||
122 | }) | ||
diff --git a/server/tests/api/index-fast.ts b/server/tests/api/index-fast.ts index d530dfc06..531a09b82 100644 --- a/server/tests/api/index-fast.ts +++ b/server/tests/api/index-fast.ts | |||
@@ -14,3 +14,4 @@ import './videos/services' | |||
14 | import './server/email' | 14 | import './server/email' |
15 | import './server/config' | 15 | import './server/config' |
16 | import './server/reverse-proxy' | 16 | import './server/reverse-proxy' |
17 | import './search/search-videos' | ||
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts new file mode 100644 index 000000000..7fc133b46 --- /dev/null +++ b/server/tests/api/search/search-videos.ts | |||
@@ -0,0 +1,299 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | ||
5 | import { | ||
6 | advancedVideosSearch, | ||
7 | flushTests, | ||
8 | killallServers, | ||
9 | runServer, | ||
10 | searchVideo, | ||
11 | ServerInfo, | ||
12 | setAccessTokensToServers, | ||
13 | uploadVideo, | ||
14 | wait, | ||
15 | immutableAssign | ||
16 | } from '../../utils' | ||
17 | |||
18 | const expect = chai.expect | ||
19 | |||
20 | describe('Test a videos search', function () { | ||
21 | let server: ServerInfo = null | ||
22 | let startDate: string | ||
23 | |||
24 | before(async function () { | ||
25 | this.timeout(30000) | ||
26 | |||
27 | await flushTests() | ||
28 | |||
29 | server = await runServer(1) | ||
30 | |||
31 | await setAccessTokensToServers([ server ]) | ||
32 | |||
33 | { | ||
34 | const attributes1 = { | ||
35 | name: '1111 2222 3333', | ||
36 | fixture: '60fps_720p_small.mp4', // 2 seconds | ||
37 | category: 1, | ||
38 | licence: 1, | ||
39 | nsfw: false, | ||
40 | language: 'fr' | ||
41 | } | ||
42 | await uploadVideo(server.url, server.accessToken, attributes1) | ||
43 | |||
44 | const attributes2 = immutableAssign(attributes1, { name: attributes1.name + ' - 2', fixture: 'video_short.mp4' }) | ||
45 | await uploadVideo(server.url, server.accessToken, attributes2) | ||
46 | |||
47 | const attributes3 = immutableAssign(attributes1, { name: attributes1.name + ' - 3', language: 'en' }) | ||
48 | await uploadVideo(server.url, server.accessToken, attributes3) | ||
49 | |||
50 | const attributes4 = immutableAssign(attributes1, { name: attributes1.name + ' - 4', language: 'pl', nsfw: true }) | ||
51 | await uploadVideo(server.url, server.accessToken, attributes4) | ||
52 | |||
53 | await wait(1000) | ||
54 | |||
55 | startDate = new Date().toISOString() | ||
56 | |||
57 | const attributes5 = immutableAssign(attributes1, { name: attributes1.name + ' - 5', licence: 2 }) | ||
58 | await uploadVideo(server.url, server.accessToken, attributes5) | ||
59 | |||
60 | const attributes6 = immutableAssign(attributes1, { name: attributes1.name + ' - 6', tags: [ 't1', 't2 '] }) | ||
61 | await uploadVideo(server.url, server.accessToken, attributes6) | ||
62 | |||
63 | const attributes7 = immutableAssign(attributes1, { name: attributes1.name + ' - 7' }) | ||
64 | await uploadVideo(server.url, server.accessToken, attributes7) | ||
65 | |||
66 | const attributes8 = immutableAssign(attributes1, { name: attributes1.name + ' - 8', licence: 4 }) | ||
67 | await uploadVideo(server.url, server.accessToken, attributes8) | ||
68 | } | ||
69 | |||
70 | { | ||
71 | const attributes = { | ||
72 | name: '3333 4444 5555', | ||
73 | fixture: 'video_short.mp4', | ||
74 | category: 2, | ||
75 | licence: 2, | ||
76 | language: 'en' | ||
77 | } | ||
78 | await uploadVideo(server.url, server.accessToken, attributes) | ||
79 | |||
80 | await uploadVideo(server.url, server.accessToken, immutableAssign(attributes, { name: attributes.name + ' duplicate' })) | ||
81 | } | ||
82 | |||
83 | { | ||
84 | const attributes = { | ||
85 | name: '6666 7777 8888', | ||
86 | fixture: 'video_short.mp4', | ||
87 | category: 3, | ||
88 | licence: 3, | ||
89 | language: 'pl' | ||
90 | } | ||
91 | await uploadVideo(server.url, server.accessToken, attributes) | ||
92 | } | ||
93 | |||
94 | { | ||
95 | const attributes1 = { | ||
96 | name: '9999', | ||
97 | tags: [ 'aaaa', 'bbbb', 'cccc' ], | ||
98 | category: 1 | ||
99 | } | ||
100 | await uploadVideo(server.url, server.accessToken, attributes1) | ||
101 | await uploadVideo(server.url, server.accessToken, immutableAssign(attributes1, { category: 2 })) | ||
102 | |||
103 | await uploadVideo(server.url, server.accessToken, immutableAssign(attributes1, { tags: [ 'cccc', 'dddd' ] })) | ||
104 | await uploadVideo(server.url, server.accessToken, immutableAssign(attributes1, { tags: [ 'eeee', 'ffff' ] })) | ||
105 | } | ||
106 | }) | ||
107 | |||
108 | it('Should make a simple search and not have results', async function () { | ||
109 | const res = await searchVideo(server.url, 'abc') | ||
110 | |||
111 | expect(res.body.total).to.equal(0) | ||
112 | expect(res.body.data).to.have.lengthOf(0) | ||
113 | }) | ||
114 | |||
115 | it('Should make a simple search and have results', async function () { | ||
116 | const res = await searchVideo(server.url, '4444 5555 duplicate') | ||
117 | |||
118 | expect(res.body.total).to.equal(2) | ||
119 | |||
120 | const videos = res.body.data | ||
121 | expect(videos).to.have.lengthOf(2) | ||
122 | |||
123 | // bestmatch | ||
124 | expect(videos[0].name).to.equal('3333 4444 5555 duplicate') | ||
125 | expect(videos[1].name).to.equal('3333 4444 5555') | ||
126 | }) | ||
127 | |||
128 | it('Should search by tags (one of)', async function () { | ||
129 | const query = { | ||
130 | search: '9999', | ||
131 | categoryOneOf: [ 1 ], | ||
132 | tagsOneOf: [ 'aaaa', 'ffff' ] | ||
133 | } | ||
134 | const res1 = await advancedVideosSearch(server.url, query) | ||
135 | expect(res1.body.total).to.equal(2) | ||
136 | |||
137 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { tagsOneOf: [ 'blabla' ] })) | ||
138 | expect(res2.body.total).to.equal(0) | ||
139 | }) | ||
140 | |||
141 | it('Should search by tags (all of)', async function () { | ||
142 | const query = { | ||
143 | search: '9999', | ||
144 | categoryOneOf: [ 1 ], | ||
145 | tagsAllOf: [ 'cccc' ] | ||
146 | } | ||
147 | const res1 = await advancedVideosSearch(server.url, query) | ||
148 | expect(res1.body.total).to.equal(2) | ||
149 | |||
150 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { tagsAllOf: [ 'blabla' ] })) | ||
151 | expect(res2.body.total).to.equal(0) | ||
152 | |||
153 | const res3 = await advancedVideosSearch(server.url, immutableAssign(query, { tagsAllOf: [ 'bbbb', 'cccc' ] })) | ||
154 | expect(res3.body.total).to.equal(1) | ||
155 | }) | ||
156 | |||
157 | it('Should search by category', async function () { | ||
158 | const query = { | ||
159 | search: '6666', | ||
160 | categoryOneOf: [ 3 ] | ||
161 | } | ||
162 | const res1 = await advancedVideosSearch(server.url, query) | ||
163 | expect(res1.body.total).to.equal(1) | ||
164 | expect(res1.body.data[0].name).to.equal('6666 7777 8888') | ||
165 | |||
166 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { categoryOneOf: [ 2 ] })) | ||
167 | expect(res2.body.total).to.equal(0) | ||
168 | }) | ||
169 | |||
170 | it('Should search by licence', async function () { | ||
171 | const query = { | ||
172 | search: '4444 5555', | ||
173 | licenceOneOf: [ 2 ] | ||
174 | } | ||
175 | const res1 = await advancedVideosSearch(server.url, query) | ||
176 | expect(res1.body.total).to.equal(2) | ||
177 | expect(res1.body.data[0].name).to.equal('3333 4444 5555') | ||
178 | expect(res1.body.data[1].name).to.equal('3333 4444 5555 duplicate') | ||
179 | |||
180 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { licenceOneOf: [ 3 ] })) | ||
181 | expect(res2.body.total).to.equal(0) | ||
182 | }) | ||
183 | |||
184 | it('Should search by languages', async function () { | ||
185 | const query = { | ||
186 | search: '1111 2222 3333', | ||
187 | languageOneOf: [ 'pl', 'en' ] | ||
188 | } | ||
189 | const res1 = await advancedVideosSearch(server.url, query) | ||
190 | expect(res1.body.total).to.equal(2) | ||
191 | expect(res1.body.data[0].name).to.equal('1111 2222 3333 - 3') | ||
192 | expect(res1.body.data[1].name).to.equal('1111 2222 3333 - 4') | ||
193 | |||
194 | const res2 = await advancedVideosSearch(server.url, immutableAssign(query, { languageOneOf: [ 'eo' ] })) | ||
195 | expect(res2.body.total).to.equal(0) | ||
196 | }) | ||
197 | |||
198 | it('Should search by start date', async function () { | ||
199 | const query = { | ||
200 | search: '1111 2222 3333', | ||
201 | startDate | ||
202 | } | ||
203 | |||
204 | const res = await advancedVideosSearch(server.url, query) | ||
205 | expect(res.body.total).to.equal(4) | ||
206 | |||
207 | const videos = res.body.data | ||
208 | expect(videos[0].name).to.equal('1111 2222 3333 - 5') | ||
209 | expect(videos[1].name).to.equal('1111 2222 3333 - 6') | ||
210 | expect(videos[2].name).to.equal('1111 2222 3333 - 7') | ||
211 | expect(videos[3].name).to.equal('1111 2222 3333 - 8') | ||
212 | }) | ||
213 | |||
214 | it('Should make an advanced search', async function () { | ||
215 | const query = { | ||
216 | search: '1111 2222 3333', | ||
217 | languageOneOf: [ 'pl', 'fr' ], | ||
218 | durationMax: 4, | ||
219 | nsfw: false, | ||
220 | licenceOneOf: [ 1, 4 ] | ||
221 | } | ||
222 | |||
223 | const res = await advancedVideosSearch(server.url, query) | ||
224 | expect(res.body.total).to.equal(4) | ||
225 | |||
226 | const videos = res.body.data | ||
227 | expect(videos[0].name).to.equal('1111 2222 3333') | ||
228 | expect(videos[1].name).to.equal('1111 2222 3333 - 6') | ||
229 | expect(videos[2].name).to.equal('1111 2222 3333 - 7') | ||
230 | expect(videos[3].name).to.equal('1111 2222 3333 - 8') | ||
231 | }) | ||
232 | |||
233 | it('Should make an advanced search and sort results', async function () { | ||
234 | const query = { | ||
235 | search: '1111 2222 3333', | ||
236 | languageOneOf: [ 'pl', 'fr' ], | ||
237 | durationMax: 4, | ||
238 | nsfw: false, | ||
239 | licenceOneOf: [ 1, 4 ], | ||
240 | sort: '-name' | ||
241 | } | ||
242 | |||
243 | const res = await advancedVideosSearch(server.url, query) | ||
244 | expect(res.body.total).to.equal(4) | ||
245 | |||
246 | const videos = res.body.data | ||
247 | expect(videos[0].name).to.equal('1111 2222 3333 - 8') | ||
248 | expect(videos[1].name).to.equal('1111 2222 3333 - 7') | ||
249 | expect(videos[2].name).to.equal('1111 2222 3333 - 6') | ||
250 | expect(videos[3].name).to.equal('1111 2222 3333') | ||
251 | }) | ||
252 | |||
253 | it('Should make an advanced search and only show the first result', async function () { | ||
254 | const query = { | ||
255 | search: '1111 2222 3333', | ||
256 | languageOneOf: [ 'pl', 'fr' ], | ||
257 | durationMax: 4, | ||
258 | nsfw: false, | ||
259 | licenceOneOf: [ 1, 4 ], | ||
260 | sort: '-name', | ||
261 | start: 0, | ||
262 | count: 1 | ||
263 | } | ||
264 | |||
265 | const res = await advancedVideosSearch(server.url, query) | ||
266 | expect(res.body.total).to.equal(4) | ||
267 | |||
268 | const videos = res.body.data | ||
269 | expect(videos[0].name).to.equal('1111 2222 3333 - 8') | ||
270 | }) | ||
271 | |||
272 | it('Should make an advanced search and only show the last result', async function () { | ||
273 | const query = { | ||
274 | search: '1111 2222 3333', | ||
275 | languageOneOf: [ 'pl', 'fr' ], | ||
276 | durationMax: 4, | ||
277 | nsfw: false, | ||
278 | licenceOneOf: [ 1, 4 ], | ||
279 | sort: '-name', | ||
280 | start: 3, | ||
281 | count: 1 | ||
282 | } | ||
283 | |||
284 | const res = await advancedVideosSearch(server.url, query) | ||
285 | expect(res.body.total).to.equal(4) | ||
286 | |||
287 | const videos = res.body.data | ||
288 | expect(videos[0].name).to.equal('1111 2222 3333') | ||
289 | }) | ||
290 | |||
291 | after(async function () { | ||
292 | killallServers([ server ]) | ||
293 | |||
294 | // Keep the logs if the test failed | ||
295 | if (this['ok']) { | ||
296 | await flushTests() | ||
297 | } | ||
298 | }) | ||
299 | }) | ||
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index d8af94e8f..ba4920d1b 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts | |||
@@ -16,13 +16,11 @@ import { | |||
16 | getVideosList, | 16 | getVideosList, |
17 | getVideosListPagination, | 17 | getVideosListPagination, |
18 | getVideosListSort, | 18 | getVideosListSort, |
19 | getVideosWithFilters, | ||
19 | killallServers, | 20 | killallServers, |
20 | rateVideo, | 21 | rateVideo, |
21 | removeVideo, | 22 | removeVideo, |
22 | runServer, | 23 | runServer, |
23 | searchVideo, | ||
24 | searchVideoWithPagination, | ||
25 | searchVideoWithSort, | ||
26 | ServerInfo, | 24 | ServerInfo, |
27 | setAccessTokensToServers, | 25 | setAccessTokensToServers, |
28 | testImage, | 26 | testImage, |
@@ -218,72 +216,6 @@ describe('Test a single server', function () { | |||
218 | expect(video.views).to.equal(3) | 216 | expect(video.views).to.equal(3) |
219 | }) | 217 | }) |
220 | 218 | ||
221 | it('Should search the video by name', async function () { | ||
222 | const res = await searchVideo(server.url, 'my') | ||
223 | |||
224 | expect(res.body.total).to.equal(1) | ||
225 | expect(res.body.data).to.be.an('array') | ||
226 | expect(res.body.data.length).to.equal(1) | ||
227 | |||
228 | const video = res.body.data[0] | ||
229 | await completeVideoCheck(server.url, video, getCheckAttributes) | ||
230 | }) | ||
231 | |||
232 | // Not implemented yet | ||
233 | // it('Should search the video by tag', async function () { | ||
234 | // const res = await searchVideo(server.url, 'tag1') | ||
235 | // | ||
236 | // expect(res.body.total).to.equal(1) | ||
237 | // expect(res.body.data).to.be.an('array') | ||
238 | // expect(res.body.data.length).to.equal(1) | ||
239 | // | ||
240 | // const video = res.body.data[0] | ||
241 | // expect(video.name).to.equal('my super name') | ||
242 | // expect(video.category).to.equal(2) | ||
243 | // expect(video.categoryLabel).to.equal('Films') | ||
244 | // expect(video.licence).to.equal(6) | ||
245 | // expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') | ||
246 | // expect(video.language).to.equal('zh') | ||
247 | // expect(video.languageLabel).to.equal('Chinese') | ||
248 | // expect(video.nsfw).to.be.ok | ||
249 | // expect(video.description).to.equal('my super description') | ||
250 | // expect(video.account.name).to.equal('root') | ||
251 | // expect(video.account.host).to.equal('localhost:9001') | ||
252 | // expect(video.isLocal).to.be.true | ||
253 | // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) | ||
254 | // expect(dateIsValid(video.createdAt)).to.be.true | ||
255 | // expect(dateIsValid(video.updatedAt)).to.be.true | ||
256 | // | ||
257 | // const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) | ||
258 | // expect(test).to.equal(true) | ||
259 | // }) | ||
260 | |||
261 | it('Should not find a search by name', async function () { | ||
262 | const res = await searchVideo(server.url, 'hello') | ||
263 | |||
264 | expect(res.body.total).to.equal(0) | ||
265 | expect(res.body.data).to.be.an('array') | ||
266 | expect(res.body.data.length).to.equal(0) | ||
267 | }) | ||
268 | |||
269 | // Not implemented yet | ||
270 | // it('Should not find a search by author', async function () { | ||
271 | // const res = await searchVideo(server.url, 'hello') | ||
272 | // | ||
273 | // expect(res.body.total).to.equal(0) | ||
274 | // expect(res.body.data).to.be.an('array') | ||
275 | // expect(res.body.data.length).to.equal(0) | ||
276 | // }) | ||
277 | // | ||
278 | // Not implemented yet | ||
279 | // it('Should not find a search by tag', async function () { | ||
280 | // const res = await searchVideo(server.url, 'hello') | ||
281 | // | ||
282 | // expect(res.body.total).to.equal(0) | ||
283 | // expect(res.body.data).to.be.an('array') | ||
284 | // expect(res.body.data.length).to.equal(0) | ||
285 | // }) | ||
286 | |||
287 | it('Should remove the video', async function () { | 219 | it('Should remove the video', async function () { |
288 | await removeVideo(server.url, server.accessToken, videoId) | 220 | await removeVideo(server.url, server.accessToken, videoId) |
289 | 221 | ||
@@ -386,65 +318,6 @@ describe('Test a single server', function () { | |||
386 | expect(videos[0].name).to.equal(videosListBase[5].name) | 318 | expect(videos[0].name).to.equal(videosListBase[5].name) |
387 | }) | 319 | }) |
388 | 320 | ||
389 | it('Should search the first video', async function () { | ||
390 | const res = await searchVideoWithPagination(server.url, 'webm', 0, 1, 'name') | ||
391 | |||
392 | const videos = res.body.data | ||
393 | expect(res.body.total).to.equal(4) | ||
394 | expect(videos.length).to.equal(1) | ||
395 | expect(videos[0].name).to.equal('video_short1.webm name') | ||
396 | }) | ||
397 | |||
398 | it('Should search the last two videos', async function () { | ||
399 | const res = await searchVideoWithPagination(server.url, 'webm', 2, 2, 'name') | ||
400 | |||
401 | const videos = res.body.data | ||
402 | expect(res.body.total).to.equal(4) | ||
403 | expect(videos.length).to.equal(2) | ||
404 | expect(videos[0].name).to.equal('video_short3.webm name') | ||
405 | expect(videos[1].name).to.equal('video_short.webm name') | ||
406 | }) | ||
407 | |||
408 | it('Should search all the webm videos', async function () { | ||
409 | const res = await searchVideoWithPagination(server.url, 'webm', 0, 15) | ||
410 | |||
411 | const videos = res.body.data | ||
412 | expect(res.body.total).to.equal(4) | ||
413 | expect(videos.length).to.equal(4) | ||
414 | }) | ||
415 | |||
416 | // Not implemented yet | ||
417 | // it('Should search all the root author videos', async function () { | ||
418 | // const res = await searchVideoWithPagination(server.url, 'root', 0, 15) | ||
419 | // | ||
420 | // const videos = res.body.data | ||
421 | // expect(res.body.total).to.equal(6) | ||
422 | // expect(videos.length).to.equal(6) | ||
423 | // }) | ||
424 | |||
425 | // Not implemented yet | ||
426 | // it('Should search all the 9001 port videos', async function () { | ||
427 | // const res = await videosUtils.searchVideoWithPagination(server.url, '9001', 'host', 0, 15) | ||
428 | |||
429 | // const videos = res.body.data | ||
430 | // expect(res.body.total).to.equal(6) | ||
431 | // expect(videos.length).to.equal(6) | ||
432 | |||
433 | // done() | ||
434 | // }) | ||
435 | // }) | ||
436 | |||
437 | // it('Should search all the localhost videos', async function () { | ||
438 | // const res = await videosUtils.searchVideoWithPagination(server.url, 'localhost', 'host', 0, 15) | ||
439 | |||
440 | // const videos = res.body.data | ||
441 | // expect(res.body.total).to.equal(6) | ||
442 | // expect(videos.length).to.equal(6) | ||
443 | |||
444 | // done() | ||
445 | // }) | ||
446 | // }) | ||
447 | |||
448 | it('Should list and sort by name in descending order', async function () { | 321 | it('Should list and sort by name in descending order', async function () { |
449 | const res = await getVideosListSort(server.url, '-name') | 322 | const res = await getVideosListSort(server.url, '-name') |
450 | 323 | ||
@@ -457,21 +330,8 @@ describe('Test a single server', function () { | |||
457 | expect(videos[3].name).to.equal('video_short3.webm name') | 330 | expect(videos[3].name).to.equal('video_short3.webm name') |
458 | expect(videos[4].name).to.equal('video_short2.webm name') | 331 | expect(videos[4].name).to.equal('video_short2.webm name') |
459 | expect(videos[5].name).to.equal('video_short1.webm name') | 332 | expect(videos[5].name).to.equal('video_short1.webm name') |
460 | }) | ||
461 | |||
462 | it('Should search and sort by name in ascending order', async function () { | ||
463 | const res = await searchVideoWithSort(server.url, 'webm', 'name') | ||
464 | 333 | ||
465 | const videos = res.body.data | 334 | videoId = videos[3].uuid |
466 | expect(res.body.total).to.equal(4) | ||
467 | expect(videos.length).to.equal(4) | ||
468 | |||
469 | expect(videos[0].name).to.equal('video_short1.webm name') | ||
470 | expect(videos[1].name).to.equal('video_short2.webm name') | ||
471 | expect(videos[2].name).to.equal('video_short3.webm name') | ||
472 | expect(videos[3].name).to.equal('video_short.webm name') | ||
473 | |||
474 | videoId = videos[2].id | ||
475 | }) | 335 | }) |
476 | 336 | ||
477 | it('Should update a video', async function () { | 337 | it('Should update a video', async function () { |
@@ -488,6 +348,15 @@ describe('Test a single server', function () { | |||
488 | await updateVideo(server.url, server.accessToken, videoId, attributes) | 348 | await updateVideo(server.url, server.accessToken, videoId, attributes) |
489 | }) | 349 | }) |
490 | 350 | ||
351 | it('Should filter by tags and category', async function () { | ||
352 | const res1 = await getVideosWithFilters(server.url, { tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: 4 }) | ||
353 | expect(res1.body.total).to.equal(1) | ||
354 | expect(res1.body.data[0].name).to.equal('my super video updated') | ||
355 | |||
356 | const res2 = await getVideosWithFilters(server.url, { tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: 3 }) | ||
357 | expect(res2.body.total).to.equal(0) | ||
358 | }) | ||
359 | |||
491 | it('Should have the video updated', async function () { | 360 | it('Should have the video updated', async function () { |
492 | this.timeout(60000) | 361 | this.timeout(60000) |
493 | 362 | ||
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index 6af0ca8af..38bdaa54e 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts | |||
@@ -30,7 +30,7 @@ describe('Test video NSFW policy', function () { | |||
30 | let userAccessToken: string | 30 | let userAccessToken: string |
31 | let customConfig: CustomConfig | 31 | let customConfig: CustomConfig |
32 | 32 | ||
33 | function getVideosFunctions (token?: string) { | 33 | function getVideosFunctions (token?: string, query = {}) { |
34 | return getMyUserInformation(server.url, server.accessToken) | 34 | return getMyUserInformation(server.url, server.accessToken) |
35 | .then(res => { | 35 | .then(res => { |
36 | const user: User = res.body | 36 | const user: User = res.body |
@@ -39,10 +39,10 @@ describe('Test video NSFW policy', function () { | |||
39 | 39 | ||
40 | if (token) { | 40 | if (token) { |
41 | return Promise.all([ | 41 | return Promise.all([ |
42 | getVideosListWithToken(server.url, token), | 42 | getVideosListWithToken(server.url, token, query), |
43 | searchVideoWithToken(server.url, 'n', token), | 43 | searchVideoWithToken(server.url, 'n', token, query), |
44 | getAccountVideos(server.url, token, accountName, 0, 5), | 44 | getAccountVideos(server.url, token, accountName, 0, 5, undefined, query), |
45 | getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5) | 45 | getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5, undefined, query) |
46 | ]) | 46 | ]) |
47 | } | 47 | } |
48 | 48 | ||
@@ -200,6 +200,26 @@ describe('Test video NSFW policy', function () { | |||
200 | expect(videos[ 0 ].name).to.equal('normal') | 200 | expect(videos[ 0 ].name).to.equal('normal') |
201 | expect(videos[ 1 ].name).to.equal('nsfw') | 201 | expect(videos[ 1 ].name).to.equal('nsfw') |
202 | }) | 202 | }) |
203 | |||
204 | it('Should display NSFW videos when the nsfw param === true', async function () { | ||
205 | for (const res of await getVideosFunctions(server.accessToken, { nsfw: true })) { | ||
206 | expect(res.body.total).to.equal(1) | ||
207 | |||
208 | const videos = res.body.data | ||
209 | expect(videos).to.have.lengthOf(1) | ||
210 | expect(videos[ 0 ].name).to.equal('nsfw') | ||
211 | } | ||
212 | }) | ||
213 | |||
214 | it('Should hide NSFW videos when the nsfw param === true', async function () { | ||
215 | for (const res of await getVideosFunctions(server.accessToken, { nsfw: false })) { | ||
216 | expect(res.body.total).to.equal(1) | ||
217 | |||
218 | const videos = res.body.data | ||
219 | expect(videos).to.have.lengthOf(1) | ||
220 | expect(videos[ 0 ].name).to.equal('normal') | ||
221 | } | ||
222 | }) | ||
203 | }) | 223 | }) |
204 | 224 | ||
205 | after(async function () { | 225 | after(async function () { |
diff --git a/server/tests/utils/index.ts b/server/tests/utils/index.ts index 5b560ca39..391db18cf 100644 --- a/server/tests/utils/index.ts +++ b/server/tests/utils/index.ts | |||
@@ -14,3 +14,4 @@ export * from './videos/video-blacklist' | |||
14 | export * from './videos/video-channels' | 14 | export * from './videos/video-channels' |
15 | export * from './videos/videos' | 15 | export * from './videos/videos' |
16 | export * from './feeds/feeds' | 16 | export * from './feeds/feeds' |
17 | export * from './search/videos' | ||
diff --git a/server/tests/utils/requests/check-api-params.ts b/server/tests/utils/requests/check-api-params.ts index 7550eb3d8..edb47e0e9 100644 --- a/server/tests/utils/requests/check-api-params.ts +++ b/server/tests/utils/requests/check-api-params.ts | |||
@@ -1,31 +1,32 @@ | |||
1 | import { makeGetRequest } from './requests' | 1 | import { makeGetRequest } from './requests' |
2 | import { immutableAssign } from '..' | ||
2 | 3 | ||
3 | function checkBadStartPagination (url: string, path: string, token?: string) { | 4 | function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { |
4 | return makeGetRequest({ | 5 | return makeGetRequest({ |
5 | url, | 6 | url, |
6 | path, | 7 | path, |
7 | token, | 8 | token, |
8 | query: { start: 'hello' }, | 9 | query: immutableAssign(query, { start: 'hello' }), |
9 | statusCodeExpected: 400 | 10 | statusCodeExpected: 400 |
10 | }) | 11 | }) |
11 | } | 12 | } |
12 | 13 | ||
13 | function checkBadCountPagination (url: string, path: string, token?: string) { | 14 | function checkBadCountPagination (url: string, path: string, token?: string, query = {}) { |
14 | return makeGetRequest({ | 15 | return makeGetRequest({ |
15 | url, | 16 | url, |
16 | path, | 17 | path, |
17 | token, | 18 | token, |
18 | query: { count: 'hello' }, | 19 | query: immutableAssign(query, { count: 'hello' }), |
19 | statusCodeExpected: 400 | 20 | statusCodeExpected: 400 |
20 | }) | 21 | }) |
21 | } | 22 | } |
22 | 23 | ||
23 | function checkBadSortPagination (url: string, path: string, token?: string) { | 24 | function checkBadSortPagination (url: string, path: string, token?: string, query = {}) { |
24 | return makeGetRequest({ | 25 | return makeGetRequest({ |
25 | url, | 26 | url, |
26 | path, | 27 | path, |
27 | token, | 28 | token, |
28 | query: { sort: 'hello' }, | 29 | query: immutableAssign(query, { sort: 'hello' }), |
29 | statusCodeExpected: 400 | 30 | statusCodeExpected: 400 |
30 | }) | 31 | }) |
31 | } | 32 | } |
diff --git a/server/tests/utils/search/videos.ts b/server/tests/utils/search/videos.ts new file mode 100644 index 000000000..3a0c10e42 --- /dev/null +++ b/server/tests/utils/search/videos.ts | |||
@@ -0,0 +1,77 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
3 | import * as request from 'supertest' | ||
4 | import { VideosSearchQuery } from '../../../../shared/models/search' | ||
5 | import { immutableAssign } from '..' | ||
6 | |||
7 | function searchVideo (url: string, search: string) { | ||
8 | const path = '/api/v1/search/videos' | ||
9 | const req = request(url) | ||
10 | .get(path) | ||
11 | .query({ sort: '-publishedAt', search }) | ||
12 | .set('Accept', 'application/json') | ||
13 | |||
14 | return req.expect(200) | ||
15 | .expect('Content-Type', /json/) | ||
16 | } | ||
17 | |||
18 | function searchVideoWithToken (url: string, search: string, token: string, query: { nsfw?: boolean } = {}) { | ||
19 | const path = '/api/v1/search/videos' | ||
20 | const req = request(url) | ||
21 | .get(path) | ||
22 | .set('Authorization', 'Bearer ' + token) | ||
23 | .query(immutableAssign(query, { sort: '-publishedAt', search })) | ||
24 | .set('Accept', 'application/json') | ||
25 | |||
26 | return req.expect(200) | ||
27 | .expect('Content-Type', /json/) | ||
28 | } | ||
29 | |||
30 | function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) { | ||
31 | const path = '/api/v1/search/videos' | ||
32 | |||
33 | const req = request(url) | ||
34 | .get(path) | ||
35 | .query({ start }) | ||
36 | .query({ search }) | ||
37 | .query({ count }) | ||
38 | |||
39 | if (sort) req.query({ sort }) | ||
40 | |||
41 | return req.set('Accept', 'application/json') | ||
42 | .expect(200) | ||
43 | .expect('Content-Type', /json/) | ||
44 | } | ||
45 | |||
46 | function searchVideoWithSort (url: string, search: string, sort: string) { | ||
47 | const path = '/api/v1/search/videos' | ||
48 | |||
49 | return request(url) | ||
50 | .get(path) | ||
51 | .query({ search }) | ||
52 | .query({ sort }) | ||
53 | .set('Accept', 'application/json') | ||
54 | .expect(200) | ||
55 | .expect('Content-Type', /json/) | ||
56 | } | ||
57 | |||
58 | function advancedVideosSearch (url: string, options: VideosSearchQuery) { | ||
59 | const path = '/api/v1/search/videos' | ||
60 | |||
61 | return request(url) | ||
62 | .get(path) | ||
63 | .query(options) | ||
64 | .set('Accept', 'application/json') | ||
65 | .expect(200) | ||
66 | .expect('Content-Type', /json/) | ||
67 | } | ||
68 | |||
69 | // --------------------------------------------------------------------------- | ||
70 | |||
71 | export { | ||
72 | searchVideo, | ||
73 | advancedVideosSearch, | ||
74 | searchVideoWithToken, | ||
75 | searchVideoWithPagination, | ||
76 | searchVideoWithSort | ||
77 | } | ||
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index a42d0f043..8c49eb02b 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -7,7 +7,7 @@ import { extname, join } from 'path' | |||
7 | import * as request from 'supertest' | 7 | import * as request from 'supertest' |
8 | import { | 8 | import { |
9 | buildAbsoluteFixturePath, | 9 | buildAbsoluteFixturePath, |
10 | getMyUserInformation, | 10 | getMyUserInformation, immutableAssign, |
11 | makeGetRequest, | 11 | makeGetRequest, |
12 | makePutBodyRequest, | 12 | makePutBodyRequest, |
13 | makeUploadRequest, | 13 | makeUploadRequest, |
@@ -133,13 +133,13 @@ function getVideosList (url: string) { | |||
133 | .expect('Content-Type', /json/) | 133 | .expect('Content-Type', /json/) |
134 | } | 134 | } |
135 | 135 | ||
136 | function getVideosListWithToken (url: string, token: string) { | 136 | function getVideosListWithToken (url: string, token: string, query: { nsfw?: boolean } = {}) { |
137 | const path = '/api/v1/videos' | 137 | const path = '/api/v1/videos' |
138 | 138 | ||
139 | return request(url) | 139 | return request(url) |
140 | .get(path) | 140 | .get(path) |
141 | .set('Authorization', 'Bearer ' + token) | 141 | .set('Authorization', 'Bearer ' + token) |
142 | .query({ sort: 'name' }) | 142 | .query(immutableAssign(query, { sort: 'name' })) |
143 | .set('Accept', 'application/json') | 143 | .set('Accept', 'application/json') |
144 | .expect(200) | 144 | .expect(200) |
145 | .expect('Content-Type', /json/) | 145 | .expect('Content-Type', /json/) |
@@ -172,17 +172,25 @@ function getMyVideos (url: string, accessToken: string, start: number, count: nu | |||
172 | .expect('Content-Type', /json/) | 172 | .expect('Content-Type', /json/) |
173 | } | 173 | } |
174 | 174 | ||
175 | function getAccountVideos (url: string, accessToken: string, accountName: string, start: number, count: number, sort?: string) { | 175 | function getAccountVideos ( |
176 | url: string, | ||
177 | accessToken: string, | ||
178 | accountName: string, | ||
179 | start: number, | ||
180 | count: number, | ||
181 | sort?: string, | ||
182 | query: { nsfw?: boolean } = {} | ||
183 | ) { | ||
176 | const path = '/api/v1/accounts/' + accountName + '/videos' | 184 | const path = '/api/v1/accounts/' + accountName + '/videos' |
177 | 185 | ||
178 | return makeGetRequest({ | 186 | return makeGetRequest({ |
179 | url, | 187 | url, |
180 | path, | 188 | path, |
181 | query: { | 189 | query: immutableAssign(query, { |
182 | start, | 190 | start, |
183 | count, | 191 | count, |
184 | sort | 192 | sort |
185 | }, | 193 | }), |
186 | token: accessToken, | 194 | token: accessToken, |
187 | statusCodeExpected: 200 | 195 | statusCodeExpected: 200 |
188 | }) | 196 | }) |
@@ -194,18 +202,19 @@ function getVideoChannelVideos ( | |||
194 | videoChannelId: number | string, | 202 | videoChannelId: number | string, |
195 | start: number, | 203 | start: number, |
196 | count: number, | 204 | count: number, |
197 | sort?: string | 205 | sort?: string, |
206 | query: { nsfw?: boolean } = {} | ||
198 | ) { | 207 | ) { |
199 | const path = '/api/v1/video-channels/' + videoChannelId + '/videos' | 208 | const path = '/api/v1/video-channels/' + videoChannelId + '/videos' |
200 | 209 | ||
201 | return makeGetRequest({ | 210 | return makeGetRequest({ |
202 | url, | 211 | url, |
203 | path, | 212 | path, |
204 | query: { | 213 | query: immutableAssign(query, { |
205 | start, | 214 | start, |
206 | count, | 215 | count, |
207 | sort | 216 | sort |
208 | }, | 217 | }), |
209 | token: accessToken, | 218 | token: accessToken, |
210 | statusCodeExpected: 200 | 219 | statusCodeExpected: 200 |
211 | }) | 220 | }) |
@@ -237,65 +246,25 @@ function getVideosListSort (url: string, sort: string) { | |||
237 | .expect('Content-Type', /json/) | 246 | .expect('Content-Type', /json/) |
238 | } | 247 | } |
239 | 248 | ||
240 | function removeVideo (url: string, token: string, id: number | string, expectedStatus = 204) { | 249 | function getVideosWithFilters (url: string, query: { tagsAllOf: string[], categoryOneOf: number[] | number }) { |
241 | const path = '/api/v1/videos' | 250 | const path = '/api/v1/videos' |
242 | 251 | ||
243 | return request(url) | 252 | return request(url) |
244 | .delete(path + '/' + id) | ||
245 | .set('Accept', 'application/json') | ||
246 | .set('Authorization', 'Bearer ' + token) | ||
247 | .expect(expectedStatus) | ||
248 | } | ||
249 | |||
250 | function searchVideo (url: string, search: string) { | ||
251 | const path = '/api/v1/search/videos' | ||
252 | const req = request(url) | ||
253 | .get(path) | 253 | .get(path) |
254 | .query({ search }) | 254 | .query(query) |
255 | .set('Accept', 'application/json') | 255 | .set('Accept', 'application/json') |
256 | 256 | .expect(200) | |
257 | return req.expect(200) | ||
258 | .expect('Content-Type', /json/) | 257 | .expect('Content-Type', /json/) |
259 | } | 258 | } |
260 | 259 | ||
261 | function searchVideoWithToken (url: string, search: string, token: string) { | 260 | function removeVideo (url: string, token: string, id: number | string, expectedStatus = 204) { |
262 | const path = '/api/v1/videos' | 261 | const path = '/api/v1/videos' |
263 | const req = request(url) | ||
264 | .get(path + '/search') | ||
265 | .set('Authorization', 'Bearer ' + token) | ||
266 | .query({ search }) | ||
267 | .set('Accept', 'application/json') | ||
268 | |||
269 | return req.expect(200) | ||
270 | .expect('Content-Type', /json/) | ||
271 | } | ||
272 | |||
273 | function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) { | ||
274 | const path = '/api/v1/search/videos' | ||
275 | |||
276 | const req = request(url) | ||
277 | .get(path) | ||
278 | .query({ start }) | ||
279 | .query({ search }) | ||
280 | .query({ count }) | ||
281 | |||
282 | if (sort) req.query({ sort }) | ||
283 | |||
284 | return req.set('Accept', 'application/json') | ||
285 | .expect(200) | ||
286 | .expect('Content-Type', /json/) | ||
287 | } | ||
288 | |||
289 | function searchVideoWithSort (url: string, search: string, sort: string) { | ||
290 | const path = '/api/v1/search/videos' | ||
291 | 262 | ||
292 | return request(url) | 263 | return request(url) |
293 | .get(path) | 264 | .delete(path + '/' + id) |
294 | .query({ search }) | ||
295 | .query({ sort }) | ||
296 | .set('Accept', 'application/json') | 265 | .set('Accept', 'application/json') |
297 | .expect(200) | 266 | .set('Authorization', 'Bearer ' + token) |
298 | .expect('Content-Type', /json/) | 267 | .expect(expectedStatus) |
299 | } | 268 | } |
300 | 269 | ||
301 | async function checkVideoFilesWereRemoved (videoUUID: string, serverNumber: number) { | 270 | async function checkVideoFilesWereRemoved (videoUUID: string, serverNumber: number) { |
@@ -581,18 +550,15 @@ export { | |||
581 | getMyVideos, | 550 | getMyVideos, |
582 | getAccountVideos, | 551 | getAccountVideos, |
583 | getVideoChannelVideos, | 552 | getVideoChannelVideos, |
584 | searchVideoWithToken, | ||
585 | getVideo, | 553 | getVideo, |
586 | getVideoWithToken, | 554 | getVideoWithToken, |
587 | getVideosList, | 555 | getVideosList, |
588 | getVideosListPagination, | 556 | getVideosListPagination, |
589 | getVideosListSort, | 557 | getVideosListSort, |
590 | removeVideo, | 558 | removeVideo, |
591 | searchVideo, | ||
592 | searchVideoWithPagination, | ||
593 | searchVideoWithSort, | ||
594 | getVideosListWithToken, | 559 | getVideosListWithToken, |
595 | uploadVideo, | 560 | uploadVideo, |
561 | getVideosWithFilters, | ||
596 | updateVideo, | 562 | updateVideo, |
597 | rateVideo, | 563 | rateVideo, |
598 | viewVideo, | 564 | viewVideo, |