diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-17 15:20:42 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 9a27cdc27c900feaae5f6db4315c4ccdfc0c4493 (patch) | |
tree | f91fcfa0fa1a2e45aae1c5333ef2f7ec60e56ef0 /server/tests/api/check-params/request-schedulers.ts | |
parent | 975e6e0e44e2f2b25f804cd48a62e2a8d9e8117a (diff) | |
download | PeerTube-9a27cdc27c900feaae5f6db4315c4ccdfc0c4493.tar.gz PeerTube-9a27cdc27c900feaae5f6db4315c4ccdfc0c4493.tar.zst PeerTube-9a27cdc27c900feaae5f6db4315c4ccdfc0c4493.zip |
Optimize signature verification
Diffstat (limited to 'server/tests/api/check-params/request-schedulers.ts')
-rw-r--r-- | server/tests/api/check-params/request-schedulers.ts | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/server/tests/api/check-params/request-schedulers.ts b/server/tests/api/check-params/request-schedulers.ts deleted file mode 100644 index 01a54ffa1..000000000 --- a/server/tests/api/check-params/request-schedulers.ts +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
3 | import * as request from 'supertest' | ||
4 | import 'mocha' | ||
5 | |||
6 | import { | ||
7 | flushTests, | ||
8 | runServer, | ||
9 | createUser, | ||
10 | setAccessTokensToServers, | ||
11 | killallServers, | ||
12 | getUserAccessToken | ||
13 | } from '../../utils' | ||
14 | |||
15 | describe('Test request schedulers stats API validators', function () { | ||
16 | const path = '/api/v1/request-schedulers/stats' | ||
17 | let server = null | ||
18 | let userAccessToken = null | ||
19 | |||
20 | // --------------------------------------------------------------- | ||
21 | |||
22 | before(async function () { | ||
23 | this.timeout(60000) | ||
24 | |||
25 | await flushTests() | ||
26 | |||
27 | server = await runServer(1) | ||
28 | await setAccessTokensToServers([ server ]) | ||
29 | |||
30 | const username = 'user' | ||
31 | const password = 'my super password' | ||
32 | await createUser(server.url, server.accessToken, username, password) | ||
33 | |||
34 | const user = { | ||
35 | username: 'user', | ||
36 | password: 'my super password' | ||
37 | } | ||
38 | |||
39 | userAccessToken = await getUserAccessToken(server, user) | ||
40 | }) | ||
41 | |||
42 | it('Should fail with an non authenticated user', async function () { | ||
43 | await request(server.url) | ||
44 | .get(path) | ||
45 | .set('Accept', 'application/json') | ||
46 | .expect(401) | ||
47 | }) | ||
48 | |||
49 | it('Should fail with a non admin user', async function () { | ||
50 | await request(server.url) | ||
51 | .get(path) | ||
52 | .set('Authorization', 'Bearer ' + userAccessToken) | ||
53 | .set('Accept', 'application/json') | ||
54 | .expect(403) | ||
55 | }) | ||
56 | |||
57 | after(async function () { | ||
58 | killallServers([ server ]) | ||
59 | |||
60 | // Keep the logs if the test failed | ||
61 | if (this['ok']) { | ||
62 | await flushTests() | ||
63 | } | ||
64 | }) | ||
65 | }) | ||