diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-03-26 18:39:01 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-03-26 18:39:01 +0200 |
commit | b4c5ac97ffa3e16f837b7e2d72291656eefac812 (patch) | |
tree | bebc031f07e4a4d6cea370690b696f10273d9b47 /server/tests/api/multiple-pods.js | |
parent | f6e692f5ee2a0e8e1fcb75df1949b354a014ad50 (diff) | |
download | PeerTube-b4c5ac97ffa3e16f837b7e2d72291656eefac812.tar.gz PeerTube-b4c5ac97ffa3e16f837b7e2d72291656eefac812.tar.zst PeerTube-b4c5ac97ffa3e16f837b7e2d72291656eefac812.zip |
Server: refractoring upload/update video test utils
Diffstat (limited to 'server/tests/api/multiple-pods.js')
-rw-r--r-- | server/tests/api/multiple-pods.js | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js index eccc9ecef..d5c723b3b 100644 --- a/server/tests/api/multiple-pods.js +++ b/server/tests/api/multiple-pods.js | |||
@@ -80,12 +80,13 @@ describe('Test multiple pods', function () { | |||
80 | 80 | ||
81 | series([ | 81 | series([ |
82 | function (next) { | 82 | function (next) { |
83 | const name = 'my super name for pod 1' | 83 | const videoAttributes = { |
84 | const category = 5 | 84 | name: 'my super name for pod 1', |
85 | const description = 'my super description for pod 1' | 85 | description: 'my super description for pod 1', |
86 | const tags = [ 'tag1p1', 'tag2p1' ] | 86 | tags: [ 'tag1p1', 'tag2p1' ], |
87 | const file = 'video_short1.webm' | 87 | fixture: 'video_short1.webm' |
88 | videosUtils.uploadVideo(servers[0].url, servers[0].accessToken, name, category, description, tags, file, next) | 88 | } |
89 | videosUtils.uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes, next) | ||
89 | }, | 90 | }, |
90 | function (next) { | 91 | function (next) { |
91 | setTimeout(next, 11000) | 92 | setTimeout(next, 11000) |
@@ -146,12 +147,14 @@ describe('Test multiple pods', function () { | |||
146 | 147 | ||
147 | series([ | 148 | series([ |
148 | function (next) { | 149 | function (next) { |
149 | const name = 'my super name for pod 2' | 150 | const videoAttributes = { |
150 | const category = 4 | 151 | name: 'my super name for pod 2', |
151 | const description = 'my super description for pod 2' | 152 | category: 4, |
152 | const tags = [ 'tag1p2', 'tag2p2', 'tag3p2' ] | 153 | description: 'my super description for pod 2', |
153 | const file = 'video_short2.webm' | 154 | tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], |
154 | videosUtils.uploadVideo(servers[1].url, servers[1].accessToken, name, category, description, tags, file, next) | 155 | fixture: 'video_short2.webm' |
156 | } | ||
157 | videosUtils.uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes, next) | ||
155 | }, | 158 | }, |
156 | function (next) { | 159 | function (next) { |
157 | setTimeout(next, 11000) | 160 | setTimeout(next, 11000) |
@@ -212,20 +215,24 @@ describe('Test multiple pods', function () { | |||
212 | 215 | ||
213 | series([ | 216 | series([ |
214 | function (next) { | 217 | function (next) { |
215 | const name = 'my super name for pod 3' | 218 | const videoAttributes = { |
216 | const category = 6 | 219 | name: 'my super name for pod 3', |
217 | const description = 'my super description for pod 3' | 220 | category: 6, |
218 | const tags = [ 'tag1p3' ] | 221 | description: 'my super description for pod 3', |
219 | const file = 'video_short3.webm' | 222 | tags: [ 'tag1p3' ], |
220 | videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, name, category, description, tags, file, next) | 223 | fixture: 'video_short3.webm' |
224 | } | ||
225 | videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes, next) | ||
221 | }, | 226 | }, |
222 | function (next) { | 227 | function (next) { |
223 | const name = 'my super name for pod 3-2' | 228 | const videoAttributes = { |
224 | const category = 7 | 229 | name: 'my super name for pod 3-2', |
225 | const description = 'my super description for pod 3-2' | 230 | category: 7, |
226 | const tags = [ 'tag2p3', 'tag3p3', 'tag4p3' ] | 231 | description: 'my super description for pod 3-2', |
227 | const file = 'video_short.webm' | 232 | tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], |
228 | videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, name, category, description, tags, file, next) | 233 | fixture: 'video_short.webm' |
234 | } | ||
235 | videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes, next) | ||
229 | }, | 236 | }, |
230 | function (next) { | 237 | function (next) { |
231 | setTimeout(next, 22000) | 238 | setTimeout(next, 22000) |
@@ -614,12 +621,13 @@ describe('Test multiple pods', function () { | |||
614 | it('Should update the video 3 by asking pod 3', function (done) { | 621 | it('Should update the video 3 by asking pod 3', function (done) { |
615 | this.timeout(15000) | 622 | this.timeout(15000) |
616 | 623 | ||
617 | const name = 'my super video updated' | 624 | const attributes = { |
618 | const category = 10 | 625 | name: 'my super video updated', |
619 | const description = 'my super description updated' | 626 | category: 10, |
620 | const tags = [ 'tagup1', 'tagup2' ] | 627 | description: 'my super description updated', |
621 | 628 | tags: [ 'tagup1', 'tagup2' ] | |
622 | videosUtils.updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, name, category, description, tags, function (err) { | 629 | } |
630 | videosUtils.updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes, function (err) { | ||
623 | if (err) throw err | 631 | if (err) throw err |
624 | 632 | ||
625 | setTimeout(done, 11000) | 633 | setTimeout(done, 11000) |