]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/utils/server/config.ts
57f95a6033aa08376d2110a5d69f32849fc968e2
[github/Chocobozzz/PeerTube.git] / server / tests / utils / server / config.ts
1 import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../'
2 import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
3
4 function getConfig (url: string) {
5 const path = '/api/v1/config'
6
7 return makeGetRequest({
8 url,
9 path,
10 statusCodeExpected: 200
11 })
12 }
13
14 function getAbout (url: string) {
15 const path = '/api/v1/config/about'
16
17 return makeGetRequest({
18 url,
19 path,
20 statusCodeExpected: 200
21 })
22 }
23
24 function getCustomConfig (url: string, token: string, statusCodeExpected = 200) {
25 const path = '/api/v1/config/custom'
26
27 return makeGetRequest({
28 url,
29 token,
30 path,
31 statusCodeExpected
32 })
33 }
34
35 function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = 200) {
36 const path = '/api/v1/config/custom'
37
38 return makePutBodyRequest({
39 url,
40 token,
41 path,
42 fields: newCustomConfig,
43 statusCodeExpected
44 })
45 }
46
47 function deleteCustomConfig (url: string, token: string, statusCodeExpected = 200) {
48 const path = '/api/v1/config/custom'
49
50 return makeDeleteRequest({
51 url,
52 token,
53 path,
54 statusCodeExpected
55 })
56 }
57
58 // ---------------------------------------------------------------------------
59
60 export {
61 getConfig,
62 getCustomConfig,
63 updateCustomConfig,
64 getAbout,
65 deleteCustomConfig
66 }