diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-29 11:29:23 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-29 11:29:23 +0200 |
commit | 4bbfc6c606c8d3794bae25c64c516120af41f4eb (patch) | |
tree | 8d6012f3c04e55e7325e3f00eb9061776cc7a953 /server/tests/utils/users | |
parent | 3ff5a19b4c988d6c712b7ce63c4cf04f99d047ce (diff) | |
download | PeerTube-4bbfc6c606c8d3794bae25c64c516120af41f4eb.tar.gz PeerTube-4bbfc6c606c8d3794bae25c64c516120af41f4eb.tar.zst PeerTube-4bbfc6c606c8d3794bae25c64c516120af41f4eb.zip |
API: Add ability to update video channel avatar
Diffstat (limited to 'server/tests/utils/users')
-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: { |