diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-06-22 13:00:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 13:00:39 +0200 |
commit | 1ebddadd0704812a4600c39cabe2268321e88331 (patch) | |
tree | 1cc8560e5b63e9976aa5411ba800a62cfe7b8ea9 /server/tests/api/check-params/video-abuses.ts | |
parent | 07aea1a2642fc9868cb01e30c322514029d5b95a (diff) | |
download | PeerTube-1ebddadd0704812a4600c39cabe2268321e88331.tar.gz PeerTube-1ebddadd0704812a4600c39cabe2268321e88331.tar.zst PeerTube-1ebddadd0704812a4600c39cabe2268321e88331.zip |
predefined report reasons & improved reporter UI (#2842)
- added `startAt` and `endAt` optional timestamps to help pin down reported sections of a video
- added predefined report reasons
- added video player with report modal
Diffstat (limited to 'server/tests/api/check-params/video-abuses.ts')
-rw-r--r-- | server/tests/api/check-params/video-abuses.ts | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts index a3fe00ffb..557bf20eb 100644 --- a/server/tests/api/check-params/video-abuses.ts +++ b/server/tests/api/check-params/video-abuses.ts | |||
@@ -20,7 +20,7 @@ import { | |||
20 | checkBadSortPagination, | 20 | checkBadSortPagination, |
21 | checkBadStartPagination | 21 | checkBadStartPagination |
22 | } from '../../../../shared/extra-utils/requests/check-api-params' | 22 | } from '../../../../shared/extra-utils/requests/check-api-params' |
23 | import { VideoAbuseState } from '../../../../shared/models/videos' | 23 | import { VideoAbuseState, VideoAbuseCreate } from '../../../../shared/models/videos' |
24 | 24 | ||
25 | describe('Test video abuses API validators', function () { | 25 | describe('Test video abuses API validators', function () { |
26 | let server: ServerInfo | 26 | let server: ServerInfo |
@@ -132,12 +132,36 @@ describe('Test video abuses API validators', function () { | |||
132 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 132 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
133 | }) | 133 | }) |
134 | 134 | ||
135 | it('Should succeed with the correct parameters', async function () { | 135 | it('Should succeed with the correct parameters (basic)', async function () { |
136 | const fields = { reason: 'super reason' } | 136 | const fields = { reason: 'my super reason' } |
137 | 137 | ||
138 | const res = await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 200 }) | 138 | const res = await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 200 }) |
139 | videoAbuseId = res.body.videoAbuse.id | 139 | videoAbuseId = res.body.videoAbuse.id |
140 | }) | 140 | }) |
141 | |||
142 | it('Should fail with a wrong predefined reason', async function () { | ||
143 | const fields = { reason: 'my super reason', predefinedReasons: [ 'wrongPredefinedReason' ] } | ||
144 | |||
145 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | ||
146 | }) | ||
147 | |||
148 | it('Should fail with negative timestamps', async function () { | ||
149 | const fields = { reason: 'my super reason', startAt: -1 } | ||
150 | |||
151 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | ||
152 | }) | ||
153 | |||
154 | it('Should fail mith misordered startAt/endAt', async function () { | ||
155 | const fields = { reason: 'my super reason', startAt: 5, endAt: 1 } | ||
156 | |||
157 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | ||
158 | }) | ||
159 | |||
160 | it('Should succeed with the corret parameters (advanced)', async function () { | ||
161 | const fields: VideoAbuseCreate = { reason: 'my super reason', predefinedReasons: [ 'serverRules' ], startAt: 1, endAt: 5 } | ||
162 | |||
163 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 200 }) | ||
164 | }) | ||
141 | }) | 165 | }) |
142 | 166 | ||
143 | describe('When updating a video abuse', function () { | 167 | describe('When updating a video abuse', function () { |