diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-05 10:58:44 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa (patch) | |
tree | c4984e854f5dc18e5c27afd73b843bd52c143034 /shared/utils/users | |
parent | 07b1a18aa678d260009a93e36606c5c5f585723d (diff) | |
download | PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.gz PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.zst PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.zip |
Add playlist rest tests
Diffstat (limited to 'shared/utils/users')
-rw-r--r-- | shared/utils/users/users.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/shared/utils/users/users.ts b/shared/utils/users/users.ts index 7191b263e..e3c14a4a3 100644 --- a/shared/utils/users/users.ts +++ b/shared/utils/users/users.ts | |||
@@ -3,6 +3,7 @@ import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '.. | |||
3 | 3 | ||
4 | import { UserRole } from '../../index' | 4 | import { UserRole } from '../../index' |
5 | import { NSFWPolicyType } from '../../models/videos/nsfw-policy.type' | 5 | import { NSFWPolicyType } from '../../models/videos/nsfw-policy.type' |
6 | import { ServerInfo, userLogin } from '..' | ||
6 | 7 | ||
7 | function createUser ( | 8 | function createUser ( |
8 | url: string, | 9 | url: string, |
@@ -32,6 +33,13 @@ function createUser ( | |||
32 | .expect(specialStatus) | 33 | .expect(specialStatus) |
33 | } | 34 | } |
34 | 35 | ||
36 | async function generateUserAccessToken (server: ServerInfo, username: string) { | ||
37 | const password = 'my super password' | ||
38 | await createUser(server.url, server.accessToken, username, password) | ||
39 | |||
40 | return userLogin(server, { username, password }) | ||
41 | } | ||
42 | |||
35 | function registerUser (url: string, username: string, password: string, specialStatus = 204) { | 43 | function registerUser (url: string, username: string, password: string, specialStatus = 204) { |
36 | const path = '/api/v1/users/register' | 44 | const path = '/api/v1/users/register' |
37 | const body = { | 45 | const body = { |
@@ -300,5 +308,6 @@ export { | |||
300 | resetPassword, | 308 | resetPassword, |
301 | updateMyAvatar, | 309 | updateMyAvatar, |
302 | askSendVerifyEmail, | 310 | askSendVerifyEmail, |
311 | generateUserAccessToken, | ||
303 | verifyEmail | 312 | verifyEmail |
304 | } | 313 | } |