diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-24 17:05:32 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-24 17:12:57 +0200 |
commit | 48dce1c90dff4e90a4bcffefaecf157336cf904b (patch) | |
tree | 478de23812d0bfd93f47e9ad6ad8888c9edcc235 /server/tests/utils/videos | |
parent | 82e392f8a42a19815e932dd386e96e61ebe6d191 (diff) | |
download | PeerTube-48dce1c90dff4e90a4bcffefaecf157336cf904b.tar.gz PeerTube-48dce1c90dff4e90a4bcffefaecf157336cf904b.tar.zst PeerTube-48dce1c90dff4e90a4bcffefaecf157336cf904b.zip |
Update video channel routes
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r-- | server/tests/utils/videos/video-channels.ts | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts index 2d095d8ab..cfc541431 100644 --- a/server/tests/utils/videos/video-channels.ts +++ b/server/tests/utils/videos/video-channels.ts | |||
@@ -7,7 +7,7 @@ type VideoChannelAttributes = { | |||
7 | } | 7 | } |
8 | 8 | ||
9 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { | 9 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { |
10 | const path = '/api/v1/videos/channels' | 10 | const path = '/api/v1/video-channels' |
11 | 11 | ||
12 | const req = request(url) | 12 | const req = request(url) |
13 | .get(path) | 13 | .get(path) |
@@ -22,7 +22,7 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?: | |||
22 | } | 22 | } |
23 | 23 | ||
24 | function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) { | 24 | function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) { |
25 | const path = '/api/v1/videos/accounts/' + accountId + '/channels' | 25 | const path = '/api/v1/accounts/' + accountId + '/video-channels' |
26 | 26 | ||
27 | return request(url) | 27 | return request(url) |
28 | .get(path) | 28 | .get(path) |
@@ -31,8 +31,14 @@ function getAccountVideoChannelsList (url: string, accountId: number | string, s | |||
31 | .expect('Content-Type', /json/) | 31 | .expect('Content-Type', /json/) |
32 | } | 32 | } |
33 | 33 | ||
34 | function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 200) { | 34 | function addVideoChannel ( |
35 | const path = '/api/v1/videos/channels' | 35 | url: string, |
36 | token: string, | ||
37 | accountId: number, | ||
38 | videoChannelAttributesArg: VideoChannelAttributes, | ||
39 | expectedStatus = 200 | ||
40 | ) { | ||
41 | const path = '/api/v1/accounts/' + accountId + '/video-channels/' | ||
36 | 42 | ||
37 | // Default attributes | 43 | // Default attributes |
38 | let attributes = { | 44 | let attributes = { |
@@ -50,9 +56,16 @@ function addVideoChannel (url: string, token: string, videoChannelAttributesArg: | |||
50 | .expect(expectedStatus) | 56 | .expect(expectedStatus) |
51 | } | 57 | } |
52 | 58 | ||
53 | function updateVideoChannel (url: string, token: string, channelId: number, attributes: VideoChannelAttributes, expectedStatus = 204) { | 59 | function updateVideoChannel ( |
60 | url: string, | ||
61 | token: string, | ||
62 | accountId: number, | ||
63 | channelId: number, | ||
64 | attributes: VideoChannelAttributes, | ||
65 | expectedStatus = 204 | ||
66 | ) { | ||
54 | const body = {} | 67 | const body = {} |
55 | const path = '/api/v1/videos/channels/' + channelId | 68 | const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId |
56 | 69 | ||
57 | if (attributes.name) body['name'] = attributes.name | 70 | if (attributes.name) body['name'] = attributes.name |
58 | if (attributes.description) body['description'] = attributes.description | 71 | if (attributes.description) body['description'] = attributes.description |
@@ -66,18 +79,18 @@ function updateVideoChannel (url: string, token: string, channelId: number, attr | |||
66 | .expect(expectedStatus) | 79 | .expect(expectedStatus) |
67 | } | 80 | } |
68 | 81 | ||
69 | function deleteVideoChannel (url: string, token: string, channelId: number, expectedStatus = 204) { | 82 | function deleteVideoChannel (url: string, token: string, accountId: number, channelId: number, expectedStatus = 204) { |
70 | const path = '/api/v1/videos/channels/' | 83 | const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId |
71 | 84 | ||
72 | return request(url) | 85 | return request(url) |
73 | .delete(path + channelId) | 86 | .delete(path) |
74 | .set('Accept', 'application/json') | 87 | .set('Accept', 'application/json') |
75 | .set('Authorization', 'Bearer ' + token) | 88 | .set('Authorization', 'Bearer ' + token) |
76 | .expect(expectedStatus) | 89 | .expect(expectedStatus) |
77 | } | 90 | } |
78 | 91 | ||
79 | function getVideoChannel (url: string, channelId: number) { | 92 | function getVideoChannel (url: string, accountId: number, channelId: number) { |
80 | const path = '/api/v1/videos/channels/' + channelId | 93 | const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId |
81 | 94 | ||
82 | return request(url) | 95 | return request(url) |
83 | .get(path) | 96 | .get(path) |