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/users.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/users.js')
-rw-r--r-- | server/tests/api/users.js | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/server/tests/api/users.js b/server/tests/api/users.js index 0f062c11f..2b6956baa 100644 --- a/server/tests/api/users.js +++ b/server/tests/api/users.js | |||
@@ -85,12 +85,8 @@ describe('Test users', function () { | |||
85 | it('Should not be able to upload a video', function (done) { | 85 | it('Should not be able to upload a video', function (done) { |
86 | accessToken = 'mysupertoken' | 86 | accessToken = 'mysupertoken' |
87 | 87 | ||
88 | const name = 'my super name' | 88 | const videoAttributes = {} |
89 | const description = 'my super description' | 89 | videosUtils.uploadVideo(server.url, accessToken, videoAttributes, 401, done) |
90 | const category = 5 | ||
91 | const tags = [ 'tag1', 'tag2' ] | ||
92 | const video = 'video_short.webm' | ||
93 | videosUtils.uploadVideo(server.url, accessToken, name, category, description, tags, video, 401, done) | ||
94 | }) | 90 | }) |
95 | 91 | ||
96 | it('Should not be able to make friends', function (done) { | 92 | it('Should not be able to make friends', function (done) { |
@@ -113,12 +109,8 @@ describe('Test users', function () { | |||
113 | }) | 109 | }) |
114 | 110 | ||
115 | it('Should upload the video with the correct token', function (done) { | 111 | it('Should upload the video with the correct token', function (done) { |
116 | const name = 'my super name' | 112 | const videoAttributes = {} |
117 | const category = 5 | 113 | videosUtils.uploadVideo(server.url, accessToken, videoAttributes, 204, function (err, res) { |
118 | const description = 'my super description' | ||
119 | const tags = [ 'tag1', 'tag2' ] | ||
120 | const video = 'video_short.webm' | ||
121 | videosUtils.uploadVideo(server.url, accessToken, name, category, description, tags, video, 204, function (err, res) { | ||
122 | if (err) throw err | 114 | if (err) throw err |
123 | 115 | ||
124 | videosUtils.getVideosList(server.url, function (err, res) { | 116 | videosUtils.getVideosList(server.url, function (err, res) { |
@@ -134,12 +126,8 @@ describe('Test users', function () { | |||
134 | }) | 126 | }) |
135 | 127 | ||
136 | it('Should upload the video again with the correct token', function (done) { | 128 | it('Should upload the video again with the correct token', function (done) { |
137 | const name = 'my super name 2' | 129 | const videoAttributes = {} |
138 | const category = 5 | 130 | videosUtils.uploadVideo(server.url, accessToken, videoAttributes, 204, done) |
139 | const description = 'my super description 2' | ||
140 | const tags = [ 'tag1' ] | ||
141 | const video = 'video_short.webm' | ||
142 | videosUtils.uploadVideo(server.url, accessToken, name, category, description, tags, video, 204, done) | ||
143 | }) | 131 | }) |
144 | 132 | ||
145 | it('Should retrieve a video rating', function (done) { | 133 | it('Should retrieve a video rating', function (done) { |
@@ -230,12 +218,8 @@ describe('Test users', function () { | |||
230 | it('Should be able to upload a video with this user', function (done) { | 218 | it('Should be able to upload a video with this user', function (done) { |
231 | this.timeout(5000) | 219 | this.timeout(5000) |
232 | 220 | ||
233 | const name = 'my super name' | 221 | const videoAttributes = {} |
234 | const category = 5 | 222 | videosUtils.uploadVideo(server.url, accessTokenUser, videoAttributes, done) |
235 | const description = 'my super description' | ||
236 | const tags = [ 'tag1', 'tag2', 'tag3' ] | ||
237 | const file = 'video_short.webm' | ||
238 | videosUtils.uploadVideo(server.url, accessTokenUser, name, category, description, tags, file, done) | ||
239 | }) | 223 | }) |
240 | 224 | ||
241 | it('Should list all the users', function (done) { | 225 | it('Should list all the users', function (done) { |