aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-24 11:04:02 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 09:41:54 +0200
commitf5b0af50c85e2f8b6b2b054ac1f47123cacbe08d (patch)
tree1b2f8a578b2d35138ac326d65674a9c9d740e8c9 /server/tests/utils
parentaa55a4da422330fe2816f1764b64f6607a0ca4aa (diff)
downloadPeerTube-f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d.tar.gz
PeerTube-f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d.tar.zst
PeerTube-f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d.zip
Search video channel handle/uri
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/search/video-channels.ts22
-rw-r--r--server/tests/utils/videos/video-channels.ts12
2 files changed, 28 insertions, 6 deletions
diff --git a/server/tests/utils/search/video-channels.ts b/server/tests/utils/search/video-channels.ts
new file mode 100644
index 000000000..0532134ae
--- /dev/null
+++ b/server/tests/utils/search/video-channels.ts
@@ -0,0 +1,22 @@
1import { makeGetRequest } from '../requests/requests'
2
3function searchVideoChannel (url: string, search: string, token?: string, statusCodeExpected = 200) {
4 const path = '/api/v1/search/video-channels'
5
6 return makeGetRequest({
7 url,
8 path,
9 query: {
10 sort: '-createdAt',
11 search
12 },
13 token,
14 statusCodeExpected
15 })
16}
17
18// ---------------------------------------------------------------------------
19
20export {
21 searchVideoChannel
22}
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts
index 1eea22b31..092985777 100644
--- a/server/tests/utils/videos/video-channels.ts
+++ b/server/tests/utils/videos/video-channels.ts
@@ -54,12 +54,12 @@ function addVideoChannel (
54function updateVideoChannel ( 54function updateVideoChannel (
55 url: string, 55 url: string,
56 token: string, 56 token: string,
57 channelId: number | string, 57 channelName: string,
58 attributes: VideoChannelUpdate, 58 attributes: VideoChannelUpdate,
59 expectedStatus = 204 59 expectedStatus = 204
60) { 60) {
61 const body = {} 61 const body = {}
62 const path = '/api/v1/video-channels/' + channelId 62 const path = '/api/v1/video-channels/' + channelName
63 63
64 if (attributes.displayName) body['displayName'] = attributes.displayName 64 if (attributes.displayName) body['displayName'] = attributes.displayName
65 if (attributes.description) body['description'] = attributes.description 65 if (attributes.description) body['description'] = attributes.description
@@ -73,8 +73,8 @@ function updateVideoChannel (
73 .expect(expectedStatus) 73 .expect(expectedStatus)
74} 74}
75 75
76function deleteVideoChannel (url: string, token: string, channelId: number | string, expectedStatus = 204) { 76function deleteVideoChannel (url: string, token: string, channelName: string, expectedStatus = 204) {
77 const path = '/api/v1/video-channels/' + channelId 77 const path = '/api/v1/video-channels/' + channelName
78 78
79 return request(url) 79 return request(url)
80 .delete(path) 80 .delete(path)
@@ -83,8 +83,8 @@ function deleteVideoChannel (url: string, token: string, channelId: number | str
83 .expect(expectedStatus) 83 .expect(expectedStatus)
84} 84}
85 85
86function getVideoChannel (url: string, channelId: number | string) { 86function getVideoChannel (url: string, channelName: string) {
87 const path = '/api/v1/video-channels/' + channelId 87 const path = '/api/v1/video-channels/' + channelName
88 88
89 return request(url) 89 return request(url)
90 .get(path) 90 .get(path)