aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 15:00:01 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commitd102de1b38f2877463529c3b27bd35ffef4fd8bf (patch)
tree31fa0bdf26ad7a2ee46d600d804a6f03260266c8 /server/tests/api/users
parent2fe978744e5b74eb824e4d79c1bb9b840169f125 (diff)
downloadPeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.gz
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.zst
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.zip
Add runner server tests
Diffstat (limited to 'server/tests/api/users')
-rw-r--r--server/tests/api/users/oauth.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/tests/api/users/oauth.ts b/server/tests/api/users/oauth.ts
index 6a3da5ea2..153615875 100644
--- a/server/tests/api/users/oauth.ts
+++ b/server/tests/api/users/oauth.ts
@@ -1,12 +1,14 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { SQLCommand } from '@server/tests/shared'
4import { wait } from '@shared/core-utils' 5import { wait } from '@shared/core-utils'
5import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@shared/models' 6import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@shared/models'
6import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' 7import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
7 8
8describe('Test oauth', function () { 9describe('Test oauth', function () {
9 let server: PeerTubeServer 10 let server: PeerTubeServer
11 let sqlCommand: SQLCommand
10 12
11 before(async function () { 13 before(async function () {
12 this.timeout(30000) 14 this.timeout(30000)
@@ -20,6 +22,8 @@ describe('Test oauth', function () {
20 }) 22 })
21 23
22 await setAccessTokensToServers([ server ]) 24 await setAccessTokensToServers([ server ])
25
26 sqlCommand = new SQLCommand(server)
23 }) 27 })
24 28
25 describe('OAuth client', function () { 29 describe('OAuth client', function () {
@@ -118,8 +122,8 @@ describe('Test oauth', function () {
118 it('Should have an expired access token', async function () { 122 it('Should have an expired access token', async function () {
119 this.timeout(60000) 123 this.timeout(60000)
120 124
121 await server.sql.setTokenField(server.accessToken, 'accessTokenExpiresAt', new Date().toISOString()) 125 await sqlCommand.setTokenField(server.accessToken, 'accessTokenExpiresAt', new Date().toISOString())
122 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) 126 await sqlCommand.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())
123 127
124 await killallServers([ server ]) 128 await killallServers([ server ])
125 await server.run() 129 await server.run()
@@ -135,7 +139,7 @@ describe('Test oauth', function () {
135 this.timeout(50000) 139 this.timeout(50000)
136 140
137 const futureDate = new Date(new Date().getTime() + 1000 * 60).toISOString() 141 const futureDate = new Date(new Date().getTime() + 1000 * 60).toISOString()
138 await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate) 142 await sqlCommand.setTokenField(server.accessToken, 'refreshTokenExpiresAt', futureDate)
139 143
140 await killallServers([ server ]) 144 await killallServers([ server ])
141 await server.run() 145 await server.run()
@@ -187,6 +191,7 @@ describe('Test oauth', function () {
187 }) 191 })
188 192
189 after(async function () { 193 after(async function () {
194 await sqlCommand.cleanup()
190 await cleanupTests([ server ]) 195 await cleanupTests([ server ])
191 }) 196 })
192}) 197})