diff options
Diffstat (limited to 'server/tests/api/checkParams.js')
-rw-r--r-- | server/tests/api/checkParams.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js index 71113fd39..1f47e5ef4 100644 --- a/server/tests/api/checkParams.js +++ b/server/tests/api/checkParams.js | |||
@@ -59,7 +59,7 @@ describe('Test parameters validator', function () { | |||
59 | function (next) { | 59 | function (next) { |
60 | utils.loginAndGetAccessToken(server, function (err, token) { | 60 | utils.loginAndGetAccessToken(server, function (err, token) { |
61 | if (err) throw err | 61 | if (err) throw err |
62 | server.access_token = token | 62 | server.accessToken = token |
63 | 63 | ||
64 | next() | 64 | next() |
65 | }) | 65 | }) |
@@ -138,7 +138,7 @@ describe('Test parameters validator', function () { | |||
138 | it('Should fail with nothing', function (done) { | 138 | it('Should fail with nothing', function (done) { |
139 | const data = {} | 139 | const data = {} |
140 | const attach = {} | 140 | const attach = {} |
141 | makePostRequest(path, server.access_token, data, attach, done) | 141 | makePostRequest(path, server.accessToken, data, attach, done) |
142 | }) | 142 | }) |
143 | 143 | ||
144 | it('Should fail without name', function (done) { | 144 | it('Should fail without name', function (done) { |
@@ -148,7 +148,7 @@ describe('Test parameters validator', function () { | |||
148 | const attach = { | 148 | const attach = { |
149 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 149 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
150 | } | 150 | } |
151 | makePostRequest(path, server.access_token, data, attach, done) | 151 | makePostRequest(path, server.accessToken, data, attach, done) |
152 | }) | 152 | }) |
153 | 153 | ||
154 | it('Should fail with a long name', function (done) { | 154 | it('Should fail with a long name', function (done) { |
@@ -159,7 +159,7 @@ describe('Test parameters validator', function () { | |||
159 | const attach = { | 159 | const attach = { |
160 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 160 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
161 | } | 161 | } |
162 | makePostRequest(path, server.access_token, data, attach, done) | 162 | makePostRequest(path, server.accessToken, data, attach, done) |
163 | }) | 163 | }) |
164 | 164 | ||
165 | it('Should fail without description', function (done) { | 165 | it('Should fail without description', function (done) { |
@@ -169,7 +169,7 @@ describe('Test parameters validator', function () { | |||
169 | const attach = { | 169 | const attach = { |
170 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 170 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
171 | } | 171 | } |
172 | makePostRequest(path, server.access_token, data, attach, done) | 172 | makePostRequest(path, server.accessToken, data, attach, done) |
173 | }) | 173 | }) |
174 | 174 | ||
175 | it('Should fail with a long description', function (done) { | 175 | it('Should fail with a long description', function (done) { |
@@ -182,7 +182,7 @@ describe('Test parameters validator', function () { | |||
182 | const attach = { | 182 | const attach = { |
183 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 183 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
184 | } | 184 | } |
185 | makePostRequest(path, server.access_token, data, attach, done) | 185 | makePostRequest(path, server.accessToken, data, attach, done) |
186 | }) | 186 | }) |
187 | 187 | ||
188 | it('Should fail without an input file', function (done) { | 188 | it('Should fail without an input file', function (done) { |
@@ -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 | makePostRequest(path, server.access_token, data, attach, done) | 194 | makePostRequest(path, server.accessToken, data, attach, done) |
195 | }) | 195 | }) |
196 | 196 | ||
197 | it('Should fail without an incorrect input file', function (done) { | 197 | it('Should fail without an incorrect input file', function (done) { |
@@ -202,7 +202,7 @@ describe('Test parameters validator', function () { | |||
202 | const attach = { | 202 | const attach = { |
203 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | 203 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') |
204 | } | 204 | } |
205 | makePostRequest(path, server.access_token, data, attach, done) | 205 | makePostRequest(path, server.accessToken, data, attach, done) |
206 | }) | 206 | }) |
207 | 207 | ||
208 | it('Should succeed with the correct parameters', function (done) { | 208 | it('Should succeed with the correct parameters', function (done) { |
@@ -213,11 +213,11 @@ describe('Test parameters validator', function () { | |||
213 | const attach = { | 213 | const attach = { |
214 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') | 214 | 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') |
215 | } | 215 | } |
216 | makePostRequest(path, server.access_token, data, attach, function () { | 216 | makePostRequest(path, server.accessToken, data, attach, function () { |
217 | attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4') | 217 | attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4') |
218 | makePostRequest(path, server.access_token, data, attach, function () { | 218 | makePostRequest(path, server.accessToken, data, attach, function () { |
219 | attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv') | 219 | attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv') |
220 | makePostRequest(path, server.access_token, data, attach, done, true) | 220 | makePostRequest(path, server.accessToken, data, attach, done, true) |
221 | }, true) | 221 | }, true) |
222 | }, true) | 222 | }, true) |
223 | }) | 223 | }) |
@@ -261,21 +261,21 @@ describe('Test parameters validator', function () { | |||
261 | it('Should have 404 with nothing', function (done) { | 261 | it('Should have 404 with nothing', function (done) { |
262 | request(server.url) | 262 | request(server.url) |
263 | .delete(path) | 263 | .delete(path) |
264 | .set('Authorization', 'Bearer ' + server.access_token) | 264 | .set('Authorization', 'Bearer ' + server.accessToken) |
265 | .expect(400, done) | 265 | .expect(400, done) |
266 | }) | 266 | }) |
267 | 267 | ||
268 | it('Should fail without a mongodb id', function (done) { | 268 | it('Should fail without a mongodb id', function (done) { |
269 | request(server.url) | 269 | request(server.url) |
270 | .delete(path + 'hello') | 270 | .delete(path + 'hello') |
271 | .set('Authorization', 'Bearer ' + server.access_token) | 271 | .set('Authorization', 'Bearer ' + server.accessToken) |
272 | .expect(400, done) | 272 | .expect(400, done) |
273 | }) | 273 | }) |
274 | 274 | ||
275 | it('Should fail with a video which does not exist', function (done) { | 275 | it('Should fail with a video which does not exist', function (done) { |
276 | request(server.url) | 276 | request(server.url) |
277 | .delete(path + '123456789012345678901234') | 277 | .delete(path + '123456789012345678901234') |
278 | .set('Authorization', 'Bearer ' + server.access_token) | 278 | .set('Authorization', 'Bearer ' + server.accessToken) |
279 | .expect(404, done) | 279 | .expect(404, done) |
280 | }) | 280 | }) |
281 | 281 | ||