diff options
Diffstat (limited to 'server/tests/utils/videos/videos.ts')
-rw-r--r-- | server/tests/utils/videos/videos.ts | 11 |
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 | ||
88 | function viewVideo (url: string, id: number | string, expectedStatus = 204) { | 88 | function 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 | ||
97 | function getVideoWithToken (url: string, token: string, id: number | string, expectedStatus = 200) { | 102 | function getVideoWithToken (url: string, token: string, id: number | string, expectedStatus = 200) { |