diff options
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) |