aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:47:51 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit254d3579f5338f5fd775c17d15cdfc37078bcfb4 (patch)
treeeaeb13fda16c16e98cd6991d202b0ca6a4cbdb63 /server/tests/api/users
parent89d241a79c262b9775c233b73cff080043ebb5e6 (diff)
downloadPeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.tar.gz
PeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.tar.zst
PeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.zip
Use an object to represent a server
Diffstat (limited to 'server/tests/api/users')
-rw-r--r--server/tests/api/users/user-subscriptions.ts8
-rw-r--r--server/tests/api/users/users-multiple-servers.ts8
-rw-r--r--server/tests/api/users/users-verification.ts6
-rw-r--r--server/tests/api/users/users.ts13
4 files changed, 17 insertions, 18 deletions
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 1b15a98dc..d2bb9c387 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 SubscriptionsCommand, 11 SubscriptionsCommand,
12 waitJobs 12 waitJobs
@@ -15,7 +15,7 @@ import {
15const expect = chai.expect 15const expect = chai.expect
16 16
17describe('Test users subscriptions', function () { 17describe('Test users subscriptions', function () {
18 let servers: ServerInfo[] = [] 18 let servers: PeerTubeServer[] = []
19 const users: { accessToken: string }[] = [] 19 const users: { accessToken: string }[] = []
20 let video3UUID: string 20 let video3UUID: string
21 21
@@ -24,7 +24,7 @@ describe('Test users subscriptions', function () {
24 before(async function () { 24 before(async function () {
25 this.timeout(120000) 25 this.timeout(120000)
26 26
27 servers = await flushAndRunMultipleServers(3) 27 servers = await createMultipleServers(3)
28 28
29 // Get the access tokens 29 // Get the access tokens
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index f8d7ae88e..e629966bb 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -8,8 +8,8 @@ import {
8 checkVideoFilesWereRemoved, 8 checkVideoFilesWereRemoved,
9 cleanupTests, 9 cleanupTests,
10 doubleFollow, 10 doubleFollow,
11 flushAndRunMultipleServers, 11 createMultipleServers,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 testImage, 14 testImage,
15 waitJobs 15 waitJobs
@@ -19,7 +19,7 @@ import { User } from '@shared/models'
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test users with multiple servers', function () { 21describe('Test users with multiple servers', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 let user: User 23 let user: User
24 let userId: number 24 let userId: number
25 let videoUUID: string 25 let videoUUID: string
@@ -29,7 +29,7 @@ describe('Test users with multiple servers', function () {
29 before(async function () { 29 before(async function () {
30 this.timeout(120_000) 30 this.timeout(120_000)
31 31
32 servers = await flushAndRunMultipleServers(3) 32 servers = await createMultipleServers(3)
33 33
34 // Get the access tokens 34 // Get the access tokens
35 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index c8c226fa8..5dbe2af59 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -3,12 +3,12 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, flushAndRunServer, MockSmtpServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 6import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10describe('Test users account verification', function () { 10describe('Test users account verification', function () {
11 let server: ServerInfo 11 let server: PeerTubeServer
12 let userId: number 12 let userId: number
13 let userAccessToken: string 13 let userAccessToken: string
14 let verificationString: string 14 let verificationString: string
@@ -34,7 +34,7 @@ describe('Test users account verification', function () {
34 port 34 port
35 } 35 }
36 } 36 }
37 server = await flushAndRunServer(1, overrideConfig) 37 server = await createSingleServer(1, overrideConfig)
38 38
39 await setAccessTokensToServers([ server ]) 39 await setAccessTokensToServers([ server ])
40 }) 40 })
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 310136a37..6ae5410b3 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -5,11 +5,10 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 killallServers, 9 killallServers,
10 makePutBodyRequest, 10 makePutBodyRequest,
11 reRunServer, 11 PeerTubeServer,
12 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 testImage, 13 testImage,
15 waitJobs 14 waitJobs
@@ -19,7 +18,7 @@ import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlayl
19const expect = chai.expect 18const expect = chai.expect
20 19
21describe('Test users', function () { 20describe('Test users', function () {
22 let server: ServerInfo 21 let server: PeerTubeServer
23 let token: string 22 let token: string
24 let userToken: string 23 let userToken: string
25 let videoId: number 24 let videoId: number
@@ -32,7 +31,7 @@ describe('Test users', function () {
32 before(async function () { 31 before(async function () {
33 this.timeout(30000) 32 this.timeout(30000)
34 33
35 server = await flushAndRunServer(1, { 34 server = await createSingleServer(1, {
36 rates_limit: { 35 rates_limit: {
37 login: { 36 login: {
38 max: 30 37 max: 30
@@ -238,7 +237,7 @@ describe('Test users', function () {
238 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) 237 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())
239 238
240 await killallServers([ server ]) 239 await killallServers([ server ])
241 await reRunServer(server) 240 await server.run()
242 241
243 await server.users.getMyInfo({ expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 242 await server.users.getMyInfo({ expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
244 }) 243 })
@@ -254,7 +253,7 @@ describe('Test users', function () {
254 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate) 253 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate)
255 254
256 await killallServers([ server ]) 255 await killallServers([ server ])
257 await reRunServer(server) 256 await server.run()
258 257
259 const res = await server.login.refreshToken({ refreshToken: server.refreshToken }) 258 const res = await server.login.refreshToken({ refreshToken: server.refreshToken })
260 server.accessToken = res.body.access_token 259 server.accessToken = res.body.access_token