aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-16 09:38:27 +0100
committerChocobozzz <me@florianbigard.com>2021-12-16 10:08:55 +0100
commitb65de1be4dcf626c552be613d531d3f6e23c6085 (patch)
tree42c4d7440f9fadee6efb48ad39ccfe1a3bce8511 /server/tests
parent9576506763c20c7efbdb229483440a1fc984cf4d (diff)
downloadPeerTube-b65de1be4dcf626c552be613d531d3f6e23c6085.tar.gz
PeerTube-b65de1be4dcf626c552be613d531d3f6e23c6085.tar.zst
PeerTube-b65de1be4dcf626c552be613d531d3f6e23c6085.zip
Use different p2p policy for embeds and webapp
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/server/config-defaults.ts97
1 files changed, 74 insertions, 23 deletions
diff --git a/server/tests/api/server/config-defaults.ts b/server/tests/api/server/config-defaults.ts
index 340d4b44b..117fc20d7 100644
--- a/server/tests/api/server/config-defaults.ts
+++ b/server/tests/api/server/config-defaults.ts
@@ -125,40 +125,91 @@ describe('Test config defaults', function () {
125 125
126 describe('Default P2P values', function () { 126 describe('Default P2P values', function () {
127 127
128 before(async function () { 128 describe('Webapp default value', function () {
129 const overrideConfig = { 129
130 defaults: { 130 before(async function () {
131 p2p: { 131 const overrideConfig = {
132 enabled: false 132 defaults: {
133 p2p: {
134 webapp: {
135 enabled: false
136 }
137 }
133 } 138 }
134 } 139 }
135 }
136 140
137 await server.kill() 141 await server.kill()
138 await server.run(overrideConfig) 142 await server.run(overrideConfig)
139 }) 143 })
140 144
141 it('Should not have P2P enabled', async function () { 145 it('Should have appropriate P2P config', async function () {
142 const config = await server.config.getConfig() 146 const config = await server.config.getConfig()
143 147
144 expect(config.defaults.p2p.enabled).to.be.false 148 expect(config.defaults.p2p.webapp.enabled).to.be.false
145 }) 149 expect(config.defaults.p2p.embed.enabled).to.be.true
150 })
151
152 it('Should create a user with this default setting', async function () {
153 await server.users.create({ username: 'user_p2p_1' })
154 const userToken = await server.login.getAccessToken('user_p2p_1')
155
156 const { p2pEnabled } = await server.users.getMyInfo({ token: userToken })
157 expect(p2pEnabled).to.be.false
158 })
146 159
147 it('Should create a user with this default setting', async function () { 160 it('Should register a user with this default setting', async function () {
148 await server.users.create({ username: 'user_p2p_1' }) 161 await server.users.register({ username: 'user_p2p_2' })
149 const userToken = await server.login.getAccessToken('user_p2p_1')
150 162
151 const { p2pEnabled } = await server.users.getMyInfo({ token: userToken }) 163 const userToken = await server.login.getAccessToken('user_p2p_2')
152 expect(p2pEnabled).to.be.false 164
165 const { p2pEnabled } = await server.users.getMyInfo({ token: userToken })
166 expect(p2pEnabled).to.be.false
167 })
153 }) 168 })
154 169
155 it('Should register a user with this default setting', async function () { 170 describe('Embed default value', function () {
156 await server.users.register({ username: 'user_p2p_2' }) 171
172 before(async function () {
173 const overrideConfig = {
174 defaults: {
175 p2p: {
176 embed: {
177 enabled: false
178 }
179 }
180 },
181 signup: {
182 limit: 15
183 }
184 }
185
186 await server.kill()
187 await server.run(overrideConfig)
188 })
189
190 it('Should have appropriate P2P config', async function () {
191 const config = await server.config.getConfig()
157 192
158 const userToken = await server.login.getAccessToken('user_p2p_2') 193 expect(config.defaults.p2p.webapp.enabled).to.be.true
194 expect(config.defaults.p2p.embed.enabled).to.be.false
195 })
196
197 it('Should create a user with this default setting', async function () {
198 await server.users.create({ username: 'user_p2p_3' })
199 const userToken = await server.login.getAccessToken('user_p2p_3')
200
201 const { p2pEnabled } = await server.users.getMyInfo({ token: userToken })
202 expect(p2pEnabled).to.be.true
203 })
159 204
160 const { p2pEnabled } = await server.users.getMyInfo({ token: userToken }) 205 it('Should register a user with this default setting', async function () {
161 expect(p2pEnabled).to.be.false 206 await server.users.register({ username: 'user_p2p_4' })
207
208 const userToken = await server.login.getAccessToken('user_p2p_4')
209
210 const { p2pEnabled } = await server.users.getMyInfo({ token: userToken })
211 expect(p2pEnabled).to.be.true
212 })
162 }) 213 })
163 }) 214 })
164 215