aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-25 11:04:18 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-25 11:07:56 +0100
commit18490b07650d77d7fe376970b749af5a8c672fd6 (patch)
tree89741e63e34c2659487c9afa8309755064cb0c39 /server/tests/api/check-params/users.ts
parent5beb89f223539f1e415a976ff104f772526b4d20 (diff)
downloadPeerTube-18490b07650d77d7fe376970b749af5a8c672fd6.tar.gz
PeerTube-18490b07650d77d7fe376970b749af5a8c672fd6.tar.zst
PeerTube-18490b07650d77d7fe376970b749af5a8c672fd6.zip
Fix migration and test
Diffstat (limited to 'server/tests/api/check-params/users.ts')
-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 () {