1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Fix migration and test

This commit is contained in:
Chocobozzz 2020-11-25 11:04:18 +01:00 committed by Chocobozzz
parent 5beb89f223
commit 18490b0765
11 changed files with 162 additions and 80 deletions

View 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 () {