X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fusers.ts;h=da7dc9704a89e23a4e1fb660b5fa709c2ebc481b;hb=18490b07650d77d7fe376970b749af5a8c672fd6;hp=2a220be83b1c863f47a56fd203d2ab23617e0b43;hpb=5beb89f223539f1e415a976ff104f772526b4d20;p=github%2FChocobozzz%2FPeerTube.git 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 { 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 () {