aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/users.ts32
1 files changed, 31 insertions, 1 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 2a220be83..da7dc9704 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -14,6 +14,7 @@ import {
14 flushAndRunServer, 14 flushAndRunServer,
15 getMyUserInformation, 15 getMyUserInformation,
16 getMyUserVideoRating, 16 getMyUserVideoRating,
17 getUserScopedTokens,
17 getUsersList, 18 getUsersList,
18 immutableAssign, 19 immutableAssign,
19 killallServers, 20 killallServers,
@@ -23,6 +24,7 @@ import {
23 makeUploadRequest, 24 makeUploadRequest,
24 registerUser, 25 registerUser,
25 removeUser, 26 removeUser,
27 renewUserScopedTokens,
26 reRunServer, 28 reRunServer,
27 ServerInfo, 29 ServerInfo,
28 setAccessTokensToServers, 30 setAccessTokensToServers,
@@ -38,7 +40,7 @@ import {
38 checkBadStartPagination 40 checkBadStartPagination
39} from '../../../../shared/extra-utils/requests/check-api-params' 41} from '../../../../shared/extra-utils/requests/check-api-params'
40import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 42import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
41import { getMagnetURI, getMyVideoImports, getGoodVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' 43import { getGoodVideoUrl, getMagnetURI, getMyVideoImports, importVideo } from '../../../../shared/extra-utils/videos/video-imports'
42import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' 44import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
43import { VideoPrivacy } from '../../../../shared/models/videos' 45import { VideoPrivacy } from '../../../../shared/models/videos'
44 46
@@ -609,6 +611,34 @@ describe('Test users API validators', function () {
609 }) 611 })
610 }) 612 })
611 613
614 describe('When managing my scoped tokens', function () {
615
616 it('Should fail to get my scoped tokens with an non authenticated user', async function () {
617 await getUserScopedTokens(server.url, null, 401)
618 })
619
620 it('Should fail to get my scoped tokens with a bad token', async function () {
621 await getUserScopedTokens(server.url, 'bad', 401)
622
623 })
624
625 it('Should succeed to get my scoped tokens', async function () {
626 await getUserScopedTokens(server.url, server.accessToken)
627 })
628
629 it('Should fail to renew my scoped tokens with an non authenticated user', async function () {
630 await renewUserScopedTokens(server.url, null, 401)
631 })
632
633 it('Should fail to renew my scoped tokens with a bad token', async function () {
634 await renewUserScopedTokens(server.url, 'bad', 401)
635 })
636
637 it('Should succeed to renew my scoped tokens', async function () {
638 await renewUserScopedTokens(server.url, server.accessToken)
639 })
640 })
641
612 describe('When getting a user', function () { 642 describe('When getting a user', function () {
613 643
614 it('Should fail with an non authenticated user', async function () { 644 it('Should fail with an non authenticated user', async function () {