diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-18 16:44:54 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-18 16:44:54 +0100 |
commit | 8c9c1942f6b5675cfca802e2f707bef3c217afbf (patch) | |
tree | cf86a39e5cda278f29cb6297b90f7ac4ff13dbad /server | |
parent | a4c157519738d89f8a77143b91e92dfd2e70380a (diff) | |
download | PeerTube-8c9c1942f6b5675cfca802e2f707bef3c217afbf.tar.gz PeerTube-8c9c1942f6b5675cfca802e2f707bef3c217afbf.tar.zst PeerTube-8c9c1942f6b5675cfca802e2f707bef3c217afbf.zip |
Change name of fields for add video api
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/v1/videos.js | 4 | ||||
-rw-r--r-- | server/tests/api/checkParams.js | 16 | ||||
-rw-r--r-- | server/tests/api/utils.js | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index 4384724c1..97d3e6b5a 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js | |||
@@ -35,7 +35,7 @@ const storage = multer.diskStorage({ | |||
35 | } | 35 | } |
36 | }) | 36 | }) |
37 | 37 | ||
38 | const reqFiles = multer({ storage: storage }).fields([{ name: 'input_video', maxCount: 1 }]) | 38 | const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) |
39 | 39 | ||
40 | router.get('/', cacheMiddleware.cache(false), listVideos) | 40 | router.get('/', cacheMiddleware.cache(false), listVideos) |
41 | router.post('/', reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo) | 41 | router.post('/', reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo) |
@@ -50,7 +50,7 @@ module.exports = router | |||
50 | // --------------------------------------------------------------------------- | 50 | // --------------------------------------------------------------------------- |
51 | 51 | ||
52 | function addVideo (req, res, next) { | 52 | function addVideo (req, res, next) { |
53 | const video_file = req.files.input_video[0] | 53 | const video_file = req.files.videofile[0] |
54 | const video_infos = req.body | 54 | const video_infos = req.body |
55 | 55 | ||
56 | videos.seed(video_file.path, function (err, torrent) { | 56 | videos.seed(video_file.path, function (err, torrent) { |
diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js index b31b0e894..dcc190e97 100644 --- a/server/tests/api/checkParams.js +++ b/server/tests/api/checkParams.js | |||
@@ -137,7 +137,7 @@ describe('Test parameters validator', function () { | |||
137 | description: 'my super description' | 137 | description: 'my super description' |
138 | } | 138 | } |
139 | const attach = { | 139 | const attach = { |
140 | 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 140 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
141 | } | 141 | } |
142 | makePostRequest(path, data, attach, done) | 142 | makePostRequest(path, data, attach, done) |
143 | }) | 143 | }) |
@@ -148,7 +148,7 @@ describe('Test parameters validator', function () { | |||
148 | description: 'my super description' | 148 | description: 'my super description' |
149 | } | 149 | } |
150 | const attach = { | 150 | const attach = { |
151 | 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 151 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
152 | } | 152 | } |
153 | makePostRequest(path, data, attach, done) | 153 | makePostRequest(path, data, attach, done) |
154 | }) | 154 | }) |
@@ -158,7 +158,7 @@ describe('Test parameters validator', function () { | |||
158 | name: 'my super name' | 158 | name: 'my super name' |
159 | } | 159 | } |
160 | const attach = { | 160 | const attach = { |
161 | 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 161 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
162 | } | 162 | } |
163 | makePostRequest(path, data, attach, done) | 163 | makePostRequest(path, data, attach, done) |
164 | }) | 164 | }) |
@@ -171,7 +171,7 @@ describe('Test parameters validator', function () { | |||
171 | 'very very very very very very very very very very very very very very very long' | 171 | 'very very very very very very very very very very very very very very very long' |
172 | } | 172 | } |
173 | const attach = { | 173 | const attach = { |
174 | 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 174 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
175 | } | 175 | } |
176 | makePostRequest(path, data, attach, done) | 176 | makePostRequest(path, data, attach, done) |
177 | }) | 177 | }) |
@@ -191,7 +191,7 @@ describe('Test parameters validator', function () { | |||
191 | description: 'my super description' | 191 | description: 'my super description' |
192 | } | 192 | } |
193 | const attach = { | 193 | const attach = { |
194 | 'input_video': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | 194 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') |
195 | } | 195 | } |
196 | makePostRequest(path, data, attach, done) | 196 | makePostRequest(path, data, attach, done) |
197 | }) | 197 | }) |
@@ -202,12 +202,12 @@ describe('Test parameters validator', function () { | |||
202 | description: 'my super description' | 202 | description: 'my super description' |
203 | } | 203 | } |
204 | const attach = { | 204 | const attach = { |
205 | 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 205 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
206 | } | 206 | } |
207 | makePostRequest(path, data, attach, function () { | 207 | makePostRequest(path, data, attach, function () { |
208 | attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4') | 208 | attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4') |
209 | makePostRequest(path, data, attach, function () { | 209 | makePostRequest(path, data, attach, function () { |
210 | attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv') | 210 | attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv') |
211 | makePostRequest(path, data, attach, done, true) | 211 | makePostRequest(path, data, attach, done, true) |
212 | }, true) | 212 | }, true) |
213 | }, true) | 213 | }, true) |
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index ea0982e81..1b2f61059 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js | |||
@@ -185,7 +185,7 @@ function uploadVideo (url, name, description, fixture, end) { | |||
185 | .set('Accept', 'application/json') | 185 | .set('Accept', 'application/json') |
186 | .field('name', name) | 186 | .field('name', name) |
187 | .field('description', description) | 187 | .field('description', description) |
188 | .attach('input_video', pathUtils.join(__dirname, 'fixtures', fixture)) | 188 | .attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture)) |
189 | .expect(204) | 189 | .expect(204) |
190 | .end(end) | 190 | .end(end) |
191 | } | 191 | } |