aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 10:42:24 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitc0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (patch)
treebaf29753ac5d4598643e3bee719f8df0cc36c59d /shared/extra-utils/users
parent08642a765ea514a00f159db898edf14c376fbe6c (diff)
downloadPeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.gz
PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.zst
PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.zip
Refactor requests
Diffstat (limited to 'shared/extra-utils/users')
-rw-r--r--shared/extra-utils/users/accounts-command.ts2
-rw-r--r--shared/extra-utils/users/blocklist-command.ts2
-rw-r--r--shared/extra-utils/users/index.ts1
-rw-r--r--shared/extra-utils/users/login-command.ts10
-rw-r--r--shared/extra-utils/users/notifications-command.ts2
-rw-r--r--shared/extra-utils/users/subscriptions-command.ts2
-rw-r--r--shared/extra-utils/users/users-command.ts2
-rw-r--r--shared/extra-utils/users/users.ts20
8 files changed, 10 insertions, 31 deletions
diff --git a/shared/extra-utils/users/accounts-command.ts b/shared/extra-utils/users/accounts-command.ts
index 4cd1d2158..08977e58b 100644
--- a/shared/extra-utils/users/accounts-command.ts
+++ b/shared/extra-utils/users/accounts-command.ts
@@ -1,5 +1,5 @@
1import { ResultList } from '@shared/models' 1import { ResultList } from '@shared/models'
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' 2import { HttpStatusCode } from '@shared/models'
3import { Account } from '../../models/actors' 3import { Account } from '../../models/actors'
4import { AccountVideoRate, VideoRateType } from '../../models/videos' 4import { AccountVideoRate, VideoRateType } from '../../models/videos'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 5import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts
index 089b5a579..a9431acf3 100644
--- a/shared/extra-utils/users/blocklist-command.ts
+++ b/shared/extra-utils/users/blocklist-command.ts
@@ -1,6 +1,6 @@
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 { HttpStatusCode } from '@shared/core-utils' 3import { HttpStatusCode } from '@shared/models'
4import { AccountBlock, ResultList, ServerBlock } from '@shared/models' 4import { AccountBlock, ResultList, ServerBlock } from '@shared/models'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 5import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 6
diff --git a/shared/extra-utils/users/index.ts b/shared/extra-utils/users/index.ts
index e6107afa5..fbb454e8f 100644
--- a/shared/extra-utils/users/index.ts
+++ b/shared/extra-utils/users/index.ts
@@ -7,4 +7,3 @@ export * from './notifications'
7export * from './notifications-command' 7export * from './notifications-command'
8export * from './subscriptions-command' 8export * from './subscriptions-command'
9export * from './users-command' 9export * from './users-command'
10export * from './users'
diff --git a/shared/extra-utils/users/login-command.ts b/shared/extra-utils/users/login-command.ts
index 10c3db851..b39577260 100644
--- a/shared/extra-utils/users/login-command.ts
+++ b/shared/extra-utils/users/login-command.ts
@@ -1,4 +1,4 @@
1import { HttpStatusCode } from '@shared/core-utils' 1import { HttpStatusCode } from '@shared/models'
2import { PeerTubeProblemDocument } from '@shared/models' 2import { PeerTubeProblemDocument } from '@shared/models'
3import { unwrapBody } from '../requests' 3import { unwrapBody } from '../requests'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
@@ -26,7 +26,7 @@ export class LoginCommand extends AbstractCommand {
26 ...options, 26 ...options,
27 27
28 path, 28 path,
29 type: 'form', 29 requestType: 'form',
30 fields: body, 30 fields: body,
31 implicitToken: false, 31 implicitToken: false,
32 defaultExpectedStatus: HttpStatusCode.OK_200 32 defaultExpectedStatus: HttpStatusCode.OK_200
@@ -72,7 +72,7 @@ export class LoginCommand extends AbstractCommand {
72 ...options, 72 ...options,
73 73
74 path, 74 path,
75 type: 'form', 75 requestType: 'form',
76 fields: body, 76 fields: body,
77 implicitToken: false, 77 implicitToken: false,
78 defaultExpectedStatus: HttpStatusCode.OK_200 78 defaultExpectedStatus: HttpStatusCode.OK_200
@@ -88,7 +88,7 @@ export class LoginCommand extends AbstractCommand {
88 ...options, 88 ...options,
89 89
90 path, 90 path,
91 type: 'form', 91 requestType: 'form',
92 implicitToken: false, 92 implicitToken: false,
93 defaultExpectedStatus: HttpStatusCode.OK_200 93 defaultExpectedStatus: HttpStatusCode.OK_200
94 })) 94 }))
@@ -111,7 +111,7 @@ export class LoginCommand extends AbstractCommand {
111 ...options, 111 ...options,
112 112
113 path, 113 path,
114 type: 'form', 114 requestType: 'form',
115 fields: body, 115 fields: body,
116 implicitToken: false, 116 implicitToken: false,
117 defaultExpectedStatus: HttpStatusCode.OK_200 117 defaultExpectedStatus: HttpStatusCode.OK_200
diff --git a/shared/extra-utils/users/notifications-command.ts b/shared/extra-utils/users/notifications-command.ts
index dfe574ca1..a51fcc3af 100644
--- a/shared/extra-utils/users/notifications-command.ts
+++ b/shared/extra-utils/users/notifications-command.ts
@@ -1,5 +1,5 @@
1import { ResultList } from '@shared/models' 1import { ResultList } from '@shared/models'
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' 2import { HttpStatusCode } from '@shared/models'
3import { UserNotification, UserNotificationSetting } from '../../models/users' 3import { UserNotification, UserNotificationSetting } from '../../models/users'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 5
diff --git a/shared/extra-utils/users/subscriptions-command.ts b/shared/extra-utils/users/subscriptions-command.ts
index e998eb426..a69d2a194 100644
--- a/shared/extra-utils/users/subscriptions-command.ts
+++ b/shared/extra-utils/users/subscriptions-command.ts
@@ -1,5 +1,5 @@
1import { ResultList, Video, VideoChannel } from '@shared/models' 1import { ResultList, Video, VideoChannel } from '@shared/models'
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' 2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 4
5export class SubscriptionsCommand extends AbstractCommand { 5export class SubscriptionsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/users/users-command.ts b/shared/extra-utils/users/users-command.ts
index 59dc6d018..f3a251e65 100644
--- a/shared/extra-utils/users/users-command.ts
+++ b/shared/extra-utils/users/users-command.ts
@@ -1,5 +1,5 @@
1import { omit, pick } from 'lodash' 1import { omit, pick } from 'lodash'
2import { HttpStatusCode } from '@shared/core-utils' 2import { HttpStatusCode } from '@shared/models'
3import { 3import {
4 MyUser, 4 MyUser,
5 ResultList, 5 ResultList,
diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.ts
deleted file mode 100644
index 6cf61d60e..000000000
--- a/shared/extra-utils/users/users.ts
+++ /dev/null
@@ -1,20 +0,0 @@
1import * as request from 'supertest'
2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
3
4// FIXME: delete once videos does not use it anymore
5function xxxgetMyUserInformation (url: string, accessToken: string, specialStatus = HttpStatusCode.OK_200) {
6 const path = '/api/v1/users/me'
7
8 return request(url)
9 .get(path)
10 .set('Accept', 'application/json')
11 .set('Authorization', 'Bearer ' + accessToken)
12 .expect(specialStatus)
13 .expect('Content-Type', /json/)
14}
15
16// ---------------------------------------------------------------------------
17
18export {
19 xxxgetMyUserInformation
20}