]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/users.ts
Fix migration and test
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / users.ts
index 2a220be83b1c863f47a56fd203d2ab23617e0b43..da7dc9704a89e23a4e1fb660b5fa709c2ebc481b 100644 (file)
@@ -14,6 +14,7 @@ import {
   flushAndRunServer,
   getMyUserInformation,
   getMyUserVideoRating,
+  getUserScopedTokens,
   getUsersList,
   immutableAssign,
   killallServers,
@@ -23,6 +24,7 @@ import {
   makeUploadRequest,
   registerUser,
   removeUser,
+  renewUserScopedTokens,
   reRunServer,
   ServerInfo,
   setAccessTokensToServers,
@@ -38,7 +40,7 @@ import {
   checkBadStartPagination
 } from '../../../../shared/extra-utils/requests/check-api-params'
 import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
-import { getMagnetURI, getMyVideoImports, getGoodVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports'
+import { getGoodVideoUrl, getMagnetURI, getMyVideoImports, importVideo } from '../../../../shared/extra-utils/videos/video-imports'
 import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
 import { VideoPrivacy } from '../../../../shared/models/videos'
 
@@ -609,6 +611,34 @@ describe('Test users API validators', function () {
     })
   })
 
+  describe('When managing my scoped tokens', function () {
+
+    it('Should fail to get my scoped tokens with an non authenticated user', async function () {
+      await getUserScopedTokens(server.url, null, 401)
+    })
+
+    it('Should fail to get my scoped tokens with a bad token', async function () {
+      await getUserScopedTokens(server.url, 'bad', 401)
+
+    })
+
+    it('Should succeed to get my scoped tokens', async function () {
+      await getUserScopedTokens(server.url, server.accessToken)
+    })
+
+    it('Should fail to renew my scoped tokens with an non authenticated user', async function () {
+      await renewUserScopedTokens(server.url, null, 401)
+    })
+
+    it('Should fail to renew my scoped tokens with a bad token', async function () {
+      await renewUserScopedTokens(server.url, 'bad', 401)
+    })
+
+    it('Should succeed to renew my scoped tokens', async function () {
+      await renewUserScopedTokens(server.url, server.accessToken)
+    })
+  })
+
   describe('When getting a user', function () {
 
     it('Should fail with an non authenticated user', async function () {