aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-29 10:58:24 +0200
committerChocobozzz <me@florianbigard.com>2018-03-29 11:03:30 +0200
commit490b595a01c5824ff63ffb87f0efdfca95f4bf3b (patch)
tree3ad716fbb97a8b4ee946ad907202b82934a33d7c /server/tests/utils/videos
parent23f4c3d412974fa5fda52589d1192e098e260f1a (diff)
downloadPeerTube-490b595a01c5824ff63ffb87f0efdfca95f4bf3b.tar.gz
PeerTube-490b595a01c5824ff63ffb87f0efdfca95f4bf3b.tar.zst
PeerTube-490b595a01c5824ff63ffb87f0efdfca95f4bf3b.zip
Prevent brute force login attack
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r--server/tests/utils/videos/videos.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 424f41ed8..9bda53371 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -85,13 +85,18 @@ function getVideo (url: string, id: number | string, expectedStatus = 200) {
85 .expect(expectedStatus) 85 .expect(expectedStatus)
86} 86}
87 87
88function viewVideo (url: string, id: number | string, expectedStatus = 204) { 88function viewVideo (url: string, id: number | string, expectedStatus = 204, xForwardedFor?: string) {
89 const path = '/api/v1/videos/' + id + '/views' 89 const path = '/api/v1/videos/' + id + '/views'
90 90
91 return request(url) 91 const req = request(url)
92 .post(path) 92 .post(path)
93 .set('Accept', 'application/json') 93 .set('Accept', 'application/json')
94 .expect(expectedStatus) 94
95 if (xForwardedFor) {
96 req.set('X-Forwarded-For', xForwardedFor)
97 }
98
99 return req.expect(expectedStatus)
95} 100}
96 101
97function getVideoWithToken (url: string, token: string, id: number | string, expectedStatus = 200) { 102function getVideoWithToken (url: string, token: string, id: number | string, expectedStatus = 200) {