diff options
Diffstat (limited to 'server/tests/utils/users/users.ts')
-rw-r--r-- | server/tests/utils/users/users.ts | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts index 34d50f7ad..37b15f64a 100644 --- a/server/tests/utils/users/users.ts +++ b/server/tests/utils/users/users.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { isAbsolute, join } from 'path' | ||
2 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
3 | import { makePostBodyRequest, makeUploadRequest, makePutBodyRequest } from '../' | 2 | import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '../' |
4 | 3 | ||
5 | import { UserRole } from '../../../../shared/index' | 4 | import { UserRole } from '../../../../shared/index' |
6 | import { NSFWPolicyType } from '../../../../shared/models/videos/nsfw-policy.type' | 5 | import { NSFWPolicyType } from '../../../../shared/models/videos/nsfw-policy.type' |
@@ -160,21 +159,8 @@ function updateMyAvatar (options: { | |||
160 | fixture: string | 159 | fixture: string |
161 | }) { | 160 | }) { |
162 | const path = '/api/v1/users/me/avatar/pick' | 161 | const path = '/api/v1/users/me/avatar/pick' |
163 | let filePath = '' | ||
164 | if (isAbsolute(options.fixture)) { | ||
165 | filePath = options.fixture | ||
166 | } else { | ||
167 | filePath = join(__dirname, '..', '..', 'fixtures', options.fixture) | ||
168 | } | ||
169 | 162 | ||
170 | return makeUploadRequest({ | 163 | return updateAvatarRequest(Object.assign(options, { path })) |
171 | url: options.url, | ||
172 | path, | ||
173 | token: options.accessToken, | ||
174 | fields: {}, | ||
175 | attaches: { avatarfile: filePath }, | ||
176 | statusCodeExpected: 200 | ||
177 | }) | ||
178 | } | 164 | } |
179 | 165 | ||
180 | function updateUser (options: { | 166 | function updateUser (options: { |