diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-09-19 21:33:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-09-19 21:33:46 +0200 |
commit | d3cd34be2fd03ea79145dfa8eb16e82d2e23191b (patch) | |
tree | 8db702444c4b72cec9de25efb2da5df0aa51cfce /server/tests/api/check-params.js | |
parent | 2e92c10b6cdb32e5170aab0b4c0ff3e4c27e30d5 (diff) | |
download | PeerTube-d3cd34be2fd03ea79145dfa8eb16e82d2e23191b.tar.gz PeerTube-d3cd34be2fd03ea79145dfa8eb16e82d2e23191b.tar.zst PeerTube-d3cd34be2fd03ea79145dfa8eb16e82d2e23191b.zip |
Server: add requests stats endpoint
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 | ||