aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/request-schedulers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/request-schedulers.ts')
-rw-r--r--server/tests/api/check-params/request-schedulers.ts65
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
3import * as request from 'supertest'
4import 'mocha'
5
6import {
7 flushTests,
8 runServer,
9 createUser,
10 setAccessTokensToServers,
11 killallServers,
12 getUserAccessToken
13} from '../../utils'
14
15describe('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})