aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos
diff options
context:
space:
mode:
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) {