From e1c5503114deef954731904695cd40dccfcef555 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Apr 2020 11:36:50 +0200 Subject: Support logout and add id and pass tests --- server/tests/api/users/users.ts | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 7ba04a4ca..60fbd2a20 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -2,8 +2,9 @@ import * as chai from 'chai' import 'mocha' -import { MyUser, User, UserRole, Video, VideoPlaylistType, VideoAbuseState, VideoAbuseUpdate } from '../../../../shared/index' +import { MyUser, User, UserRole, Video, VideoAbuseState, VideoAbuseUpdate, VideoPlaylistType } from '../../../../shared/index' import { + addVideoCommentThread, blockUser, cleanupTests, createUser, @@ -11,12 +12,14 @@ import { flushAndRunServer, getAccountRatings, getBlacklistedVideosList, + getCustomConfig, getMyUserInformation, getMyUserVideoQuotaUsed, getMyUserVideoRating, getUserInformation, getUsersList, getUsersListPaginationAndSort, + getVideoAbusesList, getVideoChannel, getVideosList, installPlugin, @@ -26,21 +29,21 @@ import { registerUserWithChannel, removeUser, removeVideo, + reportVideoAbuse, ServerInfo, testImage, unblockUser, + updateCustomSubConfig, updateMyAvatar, updateMyUser, updateUser, + updateVideoAbuse, uploadVideo, userLogin, - reportVideoAbuse, - addVideoCommentThread, - updateVideoAbuse, - getVideoAbusesList, updateCustomSubConfig, getCustomConfig, waitJobs + waitJobs } from '../../../../shared/extra-utils' import { follow } from '../../../../shared/extra-utils/server/follows' -import { setAccessTokensToServers, logout } from '../../../../shared/extra-utils/users/login' +import { logout, serverLogin, setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' import { getMyVideos } from '../../../../shared/extra-utils/videos/videos' import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' import { CustomConfig } from '@shared/models/server' @@ -60,7 +63,14 @@ describe('Test users', function () { before(async function () { this.timeout(30000) - server = await flushAndRunServer(1) + + server = await flushAndRunServer(1, { + rates_limit: { + login: { + max: 30 + } + } + }) await setAccessTokensToServers([ server ]) @@ -217,8 +227,6 @@ describe('Test users', function () { await uploadVideo(server.url, server.accessToken, { name: 'video' }, 401) }) - it('Should not be able to remove a video') - it('Should not be able to rate a video', async function () { const path = '/api/v1/videos/' const data = { @@ -235,13 +243,17 @@ describe('Test users', function () { await makePutBodyRequest(options) }) - it('Should be able to login again') + it('Should be able to login again', async function () { + server.accessToken = await serverLogin(server) + }) it('Should have an expired access token') it('Should refresh the token') - it('Should be able to upload a video again') + it('Should be able to get my user information again', async function () { + await getMyUserInformation(server.url, server.accessToken) + }) }) describe('Creating a user', function () { -- cgit v1.2.3