diff options
Diffstat (limited to 'server/tests/api/server/config-defaults.ts')
-rw-r--r-- | server/tests/api/server/config-defaults.ts | 69 |
1 files changed, 57 insertions, 12 deletions
diff --git a/server/tests/api/server/config-defaults.ts b/server/tests/api/server/config-defaults.ts index 3dff7bfb7..340d4b44b 100644 --- a/server/tests/api/server/config-defaults.ts +++ b/server/tests/api/server/config-defaults.ts | |||
@@ -21,18 +21,7 @@ describe('Test config defaults', function () { | |||
21 | before(async function () { | 21 | before(async function () { |
22 | this.timeout(30000) | 22 | this.timeout(30000) |
23 | 23 | ||
24 | const overrideConfig = { | 24 | server = await createSingleServer(1) |
25 | defaults: { | ||
26 | publish: { | ||
27 | comments_enabled: false, | ||
28 | download_enabled: false, | ||
29 | privacy: VideoPrivacy.INTERNAL, | ||
30 | licence: 4 | ||
31 | } | ||
32 | } | ||
33 | } | ||
34 | |||
35 | server = await createSingleServer(1, overrideConfig) | ||
36 | await setAccessTokensToServers([ server ]) | 25 | await setAccessTokensToServers([ server ]) |
37 | await setDefaultVideoChannel([ server ]) | 26 | await setDefaultVideoChannel([ server ]) |
38 | 27 | ||
@@ -40,6 +29,23 @@ describe('Test config defaults', function () { | |||
40 | }) | 29 | }) |
41 | 30 | ||
42 | describe('Default publish values', function () { | 31 | describe('Default publish values', function () { |
32 | |||
33 | before(async function () { | ||
34 | const overrideConfig = { | ||
35 | defaults: { | ||
36 | publish: { | ||
37 | comments_enabled: false, | ||
38 | download_enabled: false, | ||
39 | privacy: VideoPrivacy.INTERNAL, | ||
40 | licence: 4 | ||
41 | } | ||
42 | } | ||
43 | } | ||
44 | |||
45 | await server.kill() | ||
46 | await server.run(overrideConfig) | ||
47 | }) | ||
48 | |||
43 | const attributes = { | 49 | const attributes = { |
44 | name: 'video', | 50 | name: 'video', |
45 | downloadEnabled: undefined, | 51 | downloadEnabled: undefined, |
@@ -117,6 +123,45 @@ describe('Test config defaults', function () { | |||
117 | }) | 123 | }) |
118 | }) | 124 | }) |
119 | 125 | ||
126 | describe('Default P2P values', function () { | ||
127 | |||
128 | before(async function () { | ||
129 | const overrideConfig = { | ||
130 | defaults: { | ||
131 | p2p: { | ||
132 | enabled: false | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | await server.kill() | ||
138 | await server.run(overrideConfig) | ||
139 | }) | ||
140 | |||
141 | it('Should not have P2P enabled', async function () { | ||
142 | const config = await server.config.getConfig() | ||
143 | |||
144 | expect(config.defaults.p2p.enabled).to.be.false | ||
145 | }) | ||
146 | |||
147 | it('Should create a user with this default setting', async function () { | ||
148 | await server.users.create({ username: 'user_p2p_1' }) | ||
149 | const userToken = await server.login.getAccessToken('user_p2p_1') | ||
150 | |||
151 | const { p2pEnabled } = await server.users.getMyInfo({ token: userToken }) | ||
152 | expect(p2pEnabled).to.be.false | ||
153 | }) | ||
154 | |||
155 | it('Should register a user with this default setting', async function () { | ||
156 | await server.users.register({ username: 'user_p2p_2' }) | ||
157 | |||
158 | const userToken = await server.login.getAccessToken('user_p2p_2') | ||
159 | |||
160 | const { p2pEnabled } = await server.users.getMyInfo({ token: userToken }) | ||
161 | expect(p2pEnabled).to.be.false | ||
162 | }) | ||
163 | }) | ||
164 | |||
120 | after(async function () { | 165 | after(async function () { |
121 | await cleanupTests([ server ]) | 166 | await cleanupTests([ server ]) |
122 | }) | 167 | }) |