diff options
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/server/config-defaults.ts | 69 | ||||
-rw-r--r-- | server/tests/api/server/follows.ts | 2 | ||||
-rw-r--r-- | server/tests/api/users/users.ts | 22 |
3 files changed, 80 insertions, 13 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 | }) |
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 748f4cd35..c132d99ea 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -292,7 +292,7 @@ describe('Test follows', function () { | |||
292 | }) | 292 | }) |
293 | 293 | ||
294 | it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { | 294 | it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { |
295 | this.timeout(60000) | 295 | this.timeout(120000) |
296 | 296 | ||
297 | await servers[1].videos.upload({ attributes: { name: 'server2' } }) | 297 | await servers[1].videos.upload({ attributes: { name: 'server2' } }) |
298 | await servers[2].videos.upload({ attributes: { name: 'server3' } }) | 298 | await servers[2].videos.upload({ attributes: { name: 'server3' } }) |
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 6c41e7d56..f00cbab5a 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -559,6 +559,28 @@ describe('Test users', function () { | |||
559 | expect(user.autoPlayNextVideo).to.be.true | 559 | expect(user.autoPlayNextVideo).to.be.true |
560 | }) | 560 | }) |
561 | 561 | ||
562 | it('Should be able to change the p2p attribute', async function () { | ||
563 | { | ||
564 | await server.users.updateMe({ | ||
565 | token: userToken, | ||
566 | webTorrentEnabled: false | ||
567 | }) | ||
568 | |||
569 | const user = await server.users.getMyInfo({ token: userToken }) | ||
570 | expect(user.p2pEnabled).to.be.false | ||
571 | } | ||
572 | |||
573 | { | ||
574 | await server.users.updateMe({ | ||
575 | token: userToken, | ||
576 | p2pEnabled: true | ||
577 | }) | ||
578 | |||
579 | const user = await server.users.getMyInfo({ token: userToken }) | ||
580 | expect(user.p2pEnabled).to.be.true | ||
581 | } | ||
582 | }) | ||
583 | |||
562 | it('Should be able to change the email attribute', async function () { | 584 | it('Should be able to change the email attribute', async function () { |
563 | await server.users.updateMe({ | 585 | await server.users.updateMe({ |
564 | token: userToken, | 586 | token: userToken, |