diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-24 11:04:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d (patch) | |
tree | 1b2f8a578b2d35138ac326d65674a9c9d740e8c9 /server/tests/utils | |
parent | aa55a4da422330fe2816f1764b64f6607a0ca4aa (diff) | |
download | PeerTube-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.ts | 22 | ||||
-rw-r--r-- | server/tests/utils/videos/video-channels.ts | 12 |
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 @@ | |||
1 | import { makeGetRequest } from '../requests/requests' | ||
2 | |||
3 | function 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 | |||
20 | export { | ||
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 ( | |||
54 | function updateVideoChannel ( | 54 | function 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 | ||
76 | function deleteVideoChannel (url: string, token: string, channelId: number | string, expectedStatus = 204) { | 76 | function 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 | ||
86 | function getVideoChannel (url: string, channelId: number | string) { | 86 | function 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) |