diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-16 10:48:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-16 17:27:00 +0200 |
commit | 94ff4c2335ace54b36b2bca96f63226ee8f575b1 (patch) | |
tree | 60eaf4b370bdd165383231cf76cb918c19d36fc5 /server/tests/api/check-params | |
parent | f36fb3ecb114c8c274618bf9fefbe7a5a3d45f10 (diff) | |
download | PeerTube-94ff4c2335ace54b36b2bca96f63226ee8f575b1.tar.gz PeerTube-94ff4c2335ace54b36b2bca96f63226ee8f575b1.tar.zst PeerTube-94ff4c2335ace54b36b2bca96f63226ee8f575b1.zip |
Add auth documentation
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r-- | server/tests/api/check-params/users.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index ee591d620..a3e415b94 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -308,6 +308,26 @@ describe('Test users API validators', function () { | |||
308 | }) | 308 | }) |
309 | }) | 309 | }) |
310 | 310 | ||
311 | describe('When getting a user', function () { | ||
312 | before(async function () { | ||
313 | const res = await getUsersList(server.url, server.accessToken) | ||
314 | |||
315 | userId = res.body.data[1].id | ||
316 | }) | ||
317 | |||
318 | it('Should fail with an non authenticated user', async function () { | ||
319 | await makeGetRequest({ url: server.url, path: path + userId, token: 'super token', statusCodeExpected: 401 }) | ||
320 | }) | ||
321 | |||
322 | it('Should fail with a non admin user', async function () { | ||
323 | await makeGetRequest({ url: server.url, path, token: userAccessToken, statusCodeExpected: 403 }) | ||
324 | }) | ||
325 | |||
326 | it('Should succeed with the correct params', async function () { | ||
327 | await makeGetRequest({ url: server.url, path: path + userId, token: server.accessToken, statusCodeExpected: 200 }) | ||
328 | }) | ||
329 | }) | ||
330 | |||
311 | describe('When updating a user', function () { | 331 | describe('When updating a user', function () { |
312 | 332 | ||
313 | before(async function () { | 333 | before(async function () { |