diff options
Diffstat (limited to 'server/tests/api/check-params.js')
-rw-r--r-- | server/tests/api/check-params.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/server/tests/api/check-params.js b/server/tests/api/check-params.js index f060b2ad4..a696bc171 100644 --- a/server/tests/api/check-params.js +++ b/server/tests/api/check-params.js | |||
@@ -13,6 +13,7 @@ const usersUtils = require('../utils/users') | |||
13 | 13 | ||
14 | describe('Test parameters validator', function () { | 14 | describe('Test parameters validator', function () { |
15 | let server = null | 15 | let server = null |
16 | let userAccessToken = null | ||
16 | 17 | ||
17 | // --------------------------------------------------------------- | 18 | // --------------------------------------------------------------- |
18 | 19 | ||
@@ -496,7 +497,6 @@ describe('Test parameters validator', function () { | |||
496 | describe('Of the users API', function () { | 497 | describe('Of the users API', function () { |
497 | const path = '/api/v1/users/' | 498 | const path = '/api/v1/users/' |
498 | let userId = null | 499 | let userId = null |
499 | let userAccessToken = null | ||
500 | 500 | ||
501 | describe('When listing users', function () { | 501 | describe('When listing users', function () { |
502 | it('Should fail with a bad start pagination', function (done) { | 502 | it('Should fail with a bad start pagination', function (done) { |
@@ -721,6 +721,25 @@ describe('Test parameters validator', function () { | |||
721 | }) | 721 | }) |
722 | }) | 722 | }) |
723 | 723 | ||
724 | describe('Of the requests API', function () { | ||
725 | const path = '/api/v1/requests/stats' | ||
726 | |||
727 | it('Should fail with an non authenticated user', function (done) { | ||
728 | request(server.url) | ||
729 | .get(path) | ||
730 | .set('Accept', 'application/json') | ||
731 | .expect(401, done) | ||
732 | }) | ||
733 | |||
734 | it('Should fail with a non admin user', function (done) { | ||
735 | request(server.url) | ||
736 | .get(path) | ||
737 | .set('Authorization', 'Bearer ' + userAccessToken) | ||
738 | .set('Accept', 'application/json') | ||
739 | .expect(403, done) | ||
740 | }) | ||
741 | }) | ||
742 | |||
724 | after(function (done) { | 743 | after(function (done) { |
725 | process.kill(-server.app.pid) | 744 | process.kill(-server.app.pid) |
726 | 745 | ||