diff options
author | Chocobozzz <me@florianbigard.com> | 2022-01-19 14:23:00 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-01-19 14:31:05 +0100 |
commit | 419b520ca4434d17f3505013174e195c3a316716 (patch) | |
tree | 24dbf663c4e11e970cb780f96e6eb3efe023b222 /server/tests/api/check-params/jobs.ts | |
parent | 52435e467a0b30175a10af1dd3ae10d7d564d8ae (diff) | |
download | PeerTube-419b520ca4434d17f3505013174e195c3a316716.tar.gz PeerTube-419b520ca4434d17f3505013174e195c3a316716.tar.zst PeerTube-419b520ca4434d17f3505013174e195c3a316716.zip |
Add ability to cancel & delete video imports
Diffstat (limited to 'server/tests/api/check-params/jobs.ts')
-rw-r--r-- | server/tests/api/check-params/jobs.ts | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts index d85961d62..801b13d1e 100644 --- a/server/tests/api/check-params/jobs.ts +++ b/server/tests/api/check-params/jobs.ts | |||
@@ -3,7 +3,14 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' | 4 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' |
5 | import { HttpStatusCode } from '@shared/models' | 5 | import { HttpStatusCode } from '@shared/models' |
6 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 6 | import { |
7 | cleanupTests, | ||
8 | createSingleServer, | ||
9 | makeGetRequest, | ||
10 | makePostBodyRequest, | ||
11 | PeerTubeServer, | ||
12 | setAccessTokensToServers | ||
13 | } from '@shared/server-commands' | ||
7 | 14 | ||
8 | describe('Test jobs API validators', function () { | 15 | describe('Test jobs API validators', function () { |
9 | const path = '/api/v1/jobs/failed' | 16 | const path = '/api/v1/jobs/failed' |
@@ -76,7 +83,41 @@ describe('Test jobs API validators', function () { | |||
76 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 83 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
77 | }) | 84 | }) |
78 | }) | 85 | }) |
86 | }) | ||
87 | |||
88 | describe('When pausing/resuming the job queue', async function () { | ||
89 | const commands = [ 'pause', 'resume' ] | ||
90 | |||
91 | it('Should fail with a non authenticated user', async function () { | ||
92 | for (const command of commands) { | ||
93 | await makePostBodyRequest({ | ||
94 | url: server.url, | ||
95 | path: '/api/v1/jobs/' + command, | ||
96 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | ||
97 | }) | ||
98 | } | ||
99 | }) | ||
79 | 100 | ||
101 | it('Should fail with a non admin user', async function () { | ||
102 | for (const command of commands) { | ||
103 | await makePostBodyRequest({ | ||
104 | url: server.url, | ||
105 | path: '/api/v1/jobs/' + command, | ||
106 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | ||
107 | }) | ||
108 | } | ||
109 | }) | ||
110 | |||
111 | it('Should succeed with the correct params', async function () { | ||
112 | for (const command of commands) { | ||
113 | await makePostBodyRequest({ | ||
114 | url: server.url, | ||
115 | path: '/api/v1/jobs/' + command, | ||
116 | token: server.accessToken, | ||
117 | expectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
118 | }) | ||
119 | } | ||
120 | }) | ||
80 | }) | 121 | }) |
81 | 122 | ||
82 | after(async function () { | 123 | after(async function () { |