aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/accounts.ts12
-rw-r--r--server/controllers/services.ts2
-rw-r--r--server/helpers/custom-validators/accounts.ts3
-rw-r--r--server/middlewares/validators/account.ts32
-rw-r--r--server/middlewares/validators/video-channels.ts6
-rw-r--r--server/tests/api/check-params/accounts.ts4
-rw-r--r--server/tests/api/check-params/video-channels.ts10
-rw-r--r--server/tests/api/check-params/videos.ts6
-rw-r--r--server/tests/api/users/users-multiple-servers.ts15
-rw-r--r--server/tests/api/videos/video-channels.ts5
-rw-r--r--server/tests/api/videos/video-nsfw.ts6
-rw-r--r--server/tests/utils/users/accounts.ts4
-rw-r--r--server/tests/utils/videos/video-channels.ts4
-rw-r--r--server/tests/utils/videos/videos.ts4
14 files changed, 43 insertions, 70 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index ccae0436b..8e937276c 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -8,7 +8,7 @@ import {
8 setDefaultPagination, 8 setDefaultPagination,
9 setDefaultSort 9 setDefaultSort
10} from '../../middlewares' 10} from '../../middlewares'
11import { accountsGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators' 11import { accountsNameWithHostGetValidator, accountsSortValidator, videosSortValidator } from '../../middlewares/validators'
12import { AccountModel } from '../../models/account/account' 12import { AccountModel } from '../../models/account/account'
13import { VideoModel } from '../../models/video/video' 13import { VideoModel } from '../../models/video/video'
14import { isNSFWHidden } from '../../helpers/express-utils' 14import { isNSFWHidden } from '../../helpers/express-utils'
@@ -24,13 +24,13 @@ accountsRouter.get('/',
24 asyncMiddleware(listAccounts) 24 asyncMiddleware(listAccounts)
25) 25)
26 26
27accountsRouter.get('/:id', 27accountsRouter.get('/:accountName',
28 asyncMiddleware(accountsGetValidator), 28 asyncMiddleware(accountsNameWithHostGetValidator),
29 getAccount 29 getAccount
30) 30)
31 31
32accountsRouter.get('/:id/videos', 32accountsRouter.get('/:accountName/videos',
33 asyncMiddleware(accountsGetValidator), 33 asyncMiddleware(accountsNameWithHostGetValidator),
34 paginationValidator, 34 paginationValidator,
35 videosSortValidator, 35 videosSortValidator,
36 setDefaultSort, 36 setDefaultSort,
@@ -39,7 +39,7 @@ accountsRouter.get('/:id/videos',
39 asyncMiddleware(listAccountVideos) 39 asyncMiddleware(listAccountVideos)
40) 40)
41 41
42accountsRouter.get('/:accountId/video-channels', 42accountsRouter.get('/:accountName/video-channels',
43 asyncMiddleware(listVideoAccountChannelsValidator), 43 asyncMiddleware(listVideoAccountChannelsValidator),
44 asyncMiddleware(listVideoAccountChannels) 44 asyncMiddleware(listVideoAccountChannels)
45) 45)
diff --git a/server/controllers/services.ts b/server/controllers/services.ts
index c272edccd..a58a5b8cf 100644
--- a/server/controllers/services.ts
+++ b/server/controllers/services.ts
@@ -10,7 +10,7 @@ servicesRouter.use('/oembed',
10 asyncMiddleware(oembedValidator), 10 asyncMiddleware(oembedValidator),
11 generateOEmbed 11 generateOEmbed
12) 12)
13servicesRouter.use('/redirect/accounts/:nameWithHost', 13servicesRouter.use('/redirect/accounts/:accountName',
14 asyncMiddleware(accountsNameWithHostGetValidator), 14 asyncMiddleware(accountsNameWithHostGetValidator),
15 redirectToAccountUrl 15 redirectToAccountUrl
16) 16)
diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts
index 00dea9039..0607d661c 100644
--- a/server/helpers/custom-validators/accounts.ts
+++ b/server/helpers/custom-validators/accounts.ts
@@ -5,6 +5,7 @@ import * as validator from 'validator'
5import { AccountModel } from '../../models/account/account' 5import { AccountModel } from '../../models/account/account'
6import { isUserDescriptionValid, isUserUsernameValid } from './users' 6import { isUserDescriptionValid, isUserUsernameValid } from './users'
7import { exists } from './misc' 7import { exists } from './misc'
8import { CONFIG } from '../../initializers'
8 9
9function isAccountNameValid (value: string) { 10function isAccountNameValid (value: string) {
10 return isUserUsernameValid(value) 11 return isUserUsernameValid(value)
@@ -40,7 +41,7 @@ function isAccountNameWithHostExist (nameWithDomain: string, res: Response, send
40 const [ accountName, host ] = nameWithDomain.split('@') 41 const [ accountName, host ] = nameWithDomain.split('@')
41 42
42 let promise: Bluebird<AccountModel> 43 let promise: Bluebird<AccountModel>
43 if (!host) promise = AccountModel.loadLocalByName(accountName) 44 if (!host || host === CONFIG.WEBSERVER.HOST) promise = AccountModel.loadLocalByName(accountName)
44 else promise = AccountModel.loadLocalByNameAndHost(accountName, host) 45 else promise = AccountModel.loadLocalByNameAndHost(accountName, host)
45 46
46 return isAccountExist(promise, res, sendNotFound) 47 return isAccountExist(promise, res, sendNotFound)
diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts
index c01e742da..b3a51e631 100644
--- a/server/middlewares/validators/account.ts
+++ b/server/middlewares/validators/account.ts
@@ -1,15 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { param } from 'express-validator/check' 2import { param } from 'express-validator/check'
3import { 3import { isAccountNameValid, isAccountNameWithHostExist, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts'
4 isAccountIdExist,
5 isAccountIdValid,
6 isAccountNameValid,
7 isAccountNameWithHostExist,
8 isLocalAccountNameExist
9} from '../../helpers/custom-validators/accounts'
10import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
11import { areValidationErrors } from './utils' 5import { areValidationErrors } from './utils'
12import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
13 6
14const localAccountValidator = [ 7const localAccountValidator = [
15 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), 8 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'),
@@ -24,32 +17,14 @@ const localAccountValidator = [
24 } 17 }
25] 18]
26 19
27const accountsGetValidator = [
28 param('id').custom(isAccountIdValid).withMessage('Should have a valid id/uuid/name/name with host'),
29
30 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
31 logger.debug('Checking accountsGetValidator parameters', { parameters: req.params })
32
33 if (areValidationErrors(req, res)) return
34
35 let accountFetched = false
36 if (isIdOrUUIDValid(req.params.id)) accountFetched = await isAccountIdExist(req.params.id, res, false)
37 if (!accountFetched) accountFetched = await isAccountNameWithHostExist(req.params.id, res, true)
38
39 if (!accountFetched) return
40
41 return next()
42 }
43]
44
45const accountsNameWithHostGetValidator = [ 20const accountsNameWithHostGetValidator = [
46 param('nameWithHost').exists().withMessage('Should have an account name with host'), 21 param('accountName').exists().withMessage('Should have an account name with host'),
47 22
48 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 23 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
49 logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params }) 24 logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params })
50 25
51 if (areValidationErrors(req, res)) return 26 if (areValidationErrors(req, res)) return
52 if (!await isAccountNameWithHostExist(req.params.nameWithHost, res)) return 27 if (!await isAccountNameWithHostExist(req.params.accountName, res)) return
53 28
54 return next() 29 return next()
55 } 30 }
@@ -59,6 +34,5 @@ const accountsNameWithHostGetValidator = [
59 34
60export { 35export {
61 localAccountValidator, 36 localAccountValidator,
62 accountsGetValidator,
63 accountsNameWithHostGetValidator 37 accountsNameWithHostGetValidator
64} 38}
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts
index 92c0de419..a5be5f114 100644
--- a/server/middlewares/validators/video-channels.ts
+++ b/server/middlewares/validators/video-channels.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { UserRight } from '../../../shared' 3import { UserRight } from '../../../shared'
4import { isAccountIdExist } from '../../helpers/custom-validators/accounts' 4import { isAccountIdExist, isAccountNameWithHostExist } from '../../helpers/custom-validators/accounts'
5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' 5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
6import { 6import {
7 isVideoChannelDescriptionValid, 7 isVideoChannelDescriptionValid,
@@ -15,13 +15,13 @@ import { VideoChannelModel } from '../../models/video/video-channel'
15import { areValidationErrors } from './utils' 15import { areValidationErrors } from './utils'
16 16
17const listVideoAccountChannelsValidator = [ 17const listVideoAccountChannelsValidator = [
18 param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'), 18 param('accountName').exists().withMessage('Should have a valid account name'),
19 19
20 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 20 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
21 logger.debug('Checking listVideoAccountChannelsValidator parameters', { parameters: req.body }) 21 logger.debug('Checking listVideoAccountChannelsValidator parameters', { parameters: req.body })
22 22
23 if (areValidationErrors(req, res)) return 23 if (areValidationErrors(req, res)) return
24 if (!await isAccountIdExist(req.params.accountId, res)) return 24 if (!await isAccountNameWithHostExist(req.params.accountName, res)) return
25 25
26 return next() 26 return next()
27 } 27 }
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
index 50dc0804e..9e0b1e35c 100644
--- a/server/tests/api/check-params/accounts.ts
+++ b/server/tests/api/check-params/accounts.ts
@@ -35,8 +35,8 @@ describe('Test users API validators', function () {
35 }) 35 })
36 36
37 describe('When getting an account', function () { 37 describe('When getting an account', function () {
38 it('Should return 404 with a non existing id', async function () { 38 it('Should return 404 with a non existing name', async function () {
39 await getAccount(server.url, 4545454, 404) 39 await getAccount(server.url, 'arfaze', 404)
40 }) 40 })
41 }) 41 })
42 42
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 56b990be6..5080af2c9 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -7,7 +7,8 @@ import {
7 createUser, 7 createUser,
8 deleteVideoChannel, 8 deleteVideoChannel,
9 flushTests, 9 flushTests,
10 getAccountVideoChannelsList, getMyUserInformation, 10 getAccountVideoChannelsList,
11 getMyUserInformation,
11 getVideoChannelsList, 12 getVideoChannelsList,
12 immutableAssign, 13 immutableAssign,
13 killallServers, 14 killallServers,
@@ -20,7 +21,6 @@ import {
20 userLogin 21 userLogin
21} from '../../utils' 22} from '../../utils'
22import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 23import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
23import { getAccountsList } from '../../utils/users/accounts'
24import { User } from '../../../../shared/models/users' 24import { User } from '../../../../shared/models/users'
25 25
26const expect = chai.expect 26const expect = chai.expect
@@ -74,12 +74,8 @@ describe('Test video channels API validator', function () {
74 }) 74 })
75 75
76 describe('When listing account video channels', function () { 76 describe('When listing account video channels', function () {
77 it('Should fail with bad account', async function () {
78 await getAccountVideoChannelsList(server.url, 'hello', 400)
79 })
80
81 it('Should fail with a unknown account', async function () { 77 it('Should fail with a unknown account', async function () {
82 await getAccountVideoChannelsList(server.url, 154, 404) 78 await getAccountVideoChannelsList(server.url, 'unknown', 404)
83 }) 79 })
84 }) 80 })
85 81
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index c81e9752e..7b40b91e7 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -18,7 +18,7 @@ describe('Test videos API validator', function () {
18 const path = '/api/v1/videos/' 18 const path = '/api/v1/videos/'
19 let server: ServerInfo 19 let server: ServerInfo
20 let userAccessToken = '' 20 let userAccessToken = ''
21 let accountUUID: string 21 let accountName: string
22 let channelId: number 22 let channelId: number
23 let channelUUID: string 23 let channelUUID: string
24 let videoId 24 let videoId
@@ -43,7 +43,7 @@ describe('Test videos API validator', function () {
43 const res = await getMyUserInformation(server.url, server.accessToken) 43 const res = await getMyUserInformation(server.url, server.accessToken)
44 channelId = res.body.videoChannels[ 0 ].id 44 channelId = res.body.videoChannels[ 0 ].id
45 channelUUID = res.body.videoChannels[ 0 ].uuid 45 channelUUID = res.body.videoChannels[ 0 ].uuid
46 accountUUID = res.body.account.uuid 46 accountName = res.body.account.name + '@' + res.body.account.host
47 } 47 }
48 }) 48 })
49 49
@@ -116,7 +116,7 @@ describe('Test videos API validator', function () {
116 let path: string 116 let path: string
117 117
118 before(async function () { 118 before(async function () {
119 path = '/api/v1/accounts/' + accountUUID + '/videos' 119 path = '/api/v1/accounts/' + accountName + '/videos'
120 }) 120 })
121 121
122 it('Should fail with a bad start pagination', async function () { 122 it('Should fail with a bad start pagination', async function () {
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 8b9b63348..0e1e6c97d 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -26,7 +26,7 @@ const expect = chai.expect
26describe('Test users with multiple servers', function () { 26describe('Test users with multiple servers', function () {
27 let servers: ServerInfo[] = [] 27 let servers: ServerInfo[] = []
28 let user: User 28 let user: User
29 let userAccountUUID: string 29 let userAccountName: string
30 let userVideoChannelUUID: string 30 let userVideoChannelUUID: string
31 let userId: number 31 let userId: number
32 let videoUUID: string 32 let videoUUID: string
@@ -56,13 +56,16 @@ describe('Test users with multiple servers', function () {
56 password: 'password' 56 password: 'password'
57 } 57 }
58 const res = await createUser(servers[ 0 ].url, servers[ 0 ].accessToken, user.username, user.password) 58 const res = await createUser(servers[ 0 ].url, servers[ 0 ].accessToken, user.username, user.password)
59 userAccountUUID = res.body.user.account.uuid
60 userId = res.body.user.id 59 userId = res.body.user.id
61
62 userAccessToken = await userLogin(servers[ 0 ], user) 60 userAccessToken = await userLogin(servers[ 0 ], user)
63 } 61 }
64 62
65 { 63 {
64 const res = await getMyUserInformation(servers[0].url, userAccessToken)
65 userAccountName = res.body.account.name + '@' + res.body.account.host
66 }
67
68 {
66 const res = await getMyUserInformation(servers[ 0 ].url, servers[ 0 ].accessToken) 69 const res = await getMyUserInformation(servers[ 0 ].url, servers[ 0 ].accessToken)
67 const user: User = res.body 70 const user: User = res.body
68 userVideoChannelUUID = user.videoChannels[0].uuid 71 userVideoChannelUUID = user.videoChannels[0].uuid
@@ -135,7 +138,7 @@ describe('Test users with multiple servers', function () {
135 const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:9001') as Account 138 const rootServer1List = resAccounts.body.data.find(a => a.name === 'root' && a.host === 'localhost:9001') as Account
136 expect(rootServer1List).not.to.be.undefined 139 expect(rootServer1List).not.to.be.undefined
137 140
138 const resAccount = await getAccount(server.url, rootServer1List.id) 141 const resAccount = await getAccount(server.url, rootServer1List.name + '@' + rootServer1List.host)
139 const rootServer1Get = resAccount.body as Account 142 const rootServer1Get = resAccount.body as Account
140 expect(rootServer1Get.name).to.equal('root') 143 expect(rootServer1Get.name).to.equal('root')
141 expect(rootServer1Get.host).to.equal('localhost:9001') 144 expect(rootServer1Get.host).to.equal('localhost:9001')
@@ -148,7 +151,7 @@ describe('Test users with multiple servers', function () {
148 151
149 it('Should list account videos', async function () { 152 it('Should list account videos', async function () {
150 for (const server of servers) { 153 for (const server of servers) {
151 const res = await getAccountVideos(server.url, server.accessToken, userAccountUUID, 0, 5) 154 const res = await getAccountVideos(server.url, server.accessToken, userAccountName, 0, 5)
152 155
153 expect(res.body.total).to.equal(1) 156 expect(res.body.total).to.equal(1)
154 expect(res.body.data).to.be.an('array') 157 expect(res.body.data).to.be.an('array')
@@ -193,7 +196,7 @@ describe('Test users with multiple servers', function () {
193 196
194 it('Should not have actor files', async () => { 197 it('Should not have actor files', async () => {
195 for (const server of servers) { 198 for (const server of servers) {
196 await checkActorFilesWereRemoved(userAccountUUID, server.serverNumber) 199 await checkActorFilesWereRemoved(userAccountName, server.serverNumber)
197 await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber) 200 await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber)
198 } 201 }
199 }) 202 })
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 35c418f7c..7ae505fd7 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -17,7 +17,6 @@ import {
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 updateVideoChannel 18 updateVideoChannel
19} from '../../utils/index' 19} from '../../utils/index'
20import { getAccountsList } from '../../utils/users/accounts'
21 20
22const expect = chai.expect 21const expect = chai.expect
23 22
@@ -99,7 +98,7 @@ describe('Test video channels', function () {
99 }) 98 })
100 99
101 it('Should have two video channels when getting account channels on server 1', async function () { 100 it('Should have two video channels when getting account channels on server 1', async function () {
102 const res = await getAccountVideoChannelsList(servers[0].url, userInfo.account.uuid) 101 const res = await getAccountVideoChannelsList(servers[0].url, userInfo.account.name + '@' + userInfo.account.host)
103 expect(res.body.total).to.equal(2) 102 expect(res.body.total).to.equal(2)
104 expect(res.body.data).to.be.an('array') 103 expect(res.body.data).to.be.an('array')
105 expect(res.body.data).to.have.lengthOf(2) 104 expect(res.body.data).to.have.lengthOf(2)
@@ -112,7 +111,7 @@ describe('Test video channels', function () {
112 }) 111 })
113 112
114 it('Should have one video channel when getting account channels on server 2', async function () { 113 it('Should have one video channel when getting account channels on server 2', async function () {
115 const res = await getAccountVideoChannelsList(servers[1].url, userInfo.account.uuid) 114 const res = await getAccountVideoChannelsList(servers[1].url, userInfo.account.name + '@' + userInfo.account.host)
116 expect(res.body.total).to.equal(1) 115 expect(res.body.total).to.equal(1)
117 expect(res.body.data).to.be.an('array') 116 expect(res.body.data).to.be.an('array')
118 expect(res.body.data).to.have.lengthOf(1) 117 expect(res.body.data).to.have.lengthOf(1)
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index b8c85f45b..a8f152561 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -32,13 +32,13 @@ describe('Test video NSFW policy', function () {
32 .then(res => { 32 .then(res => {
33 const user: User = res.body 33 const user: User = res.body
34 const videoChannelUUID = user.videoChannels[0].uuid 34 const videoChannelUUID = user.videoChannels[0].uuid
35 const accountUUID = user.account.uuid 35 const accountName = user.account.name + '@' + user.account.host
36 36
37 if (token) { 37 if (token) {
38 return Promise.all([ 38 return Promise.all([
39 getVideosListWithToken(server.url, token), 39 getVideosListWithToken(server.url, token),
40 searchVideoWithToken(server.url, 'n', token), 40 searchVideoWithToken(server.url, 'n', token),
41 getAccountVideos(server.url, token, accountUUID, 0, 5), 41 getAccountVideos(server.url, token, accountName, 0, 5),
42 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5) 42 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5)
43 ]) 43 ])
44 } 44 }
@@ -46,7 +46,7 @@ describe('Test video NSFW policy', function () {
46 return Promise.all([ 46 return Promise.all([
47 getVideosList(server.url), 47 getVideosList(server.url),
48 searchVideo(server.url, 'n'), 48 searchVideo(server.url, 'n'),
49 getAccountVideos(server.url, undefined, accountUUID, 0, 5), 49 getAccountVideos(server.url, undefined, accountName, 0, 5),
50 getVideoChannelVideos(server.url, undefined, videoChannelUUID, 0, 5) 50 getVideoChannelVideos(server.url, undefined, videoChannelUUID, 0, 5)
51 ]) 51 ])
52 }) 52 })
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts
index a5c13c319..30b3c54f8 100644
--- a/server/tests/utils/users/accounts.ts
+++ b/server/tests/utils/users/accounts.ts
@@ -19,8 +19,8 @@ function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected =
19 }) 19 })
20} 20}
21 21
22function getAccount (url: string, accountId: number | string, statusCodeExpected = 200) { 22function getAccount (url: string, accountName: string, statusCodeExpected = 200) {
23 const path = '/api/v1/accounts/' + accountId 23 const path = '/api/v1/accounts/' + accountName
24 24
25 return makeGetRequest({ 25 return makeGetRequest({
26 url, 26 url,
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts
index 021c4c420..a064598f4 100644
--- a/server/tests/utils/videos/video-channels.ts
+++ b/server/tests/utils/videos/video-channels.ts
@@ -16,8 +16,8 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?:
16 .expect('Content-Type', /json/) 16 .expect('Content-Type', /json/)
17} 17}
18 18
19function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) { 19function getAccountVideoChannelsList (url: string, accountName: string, specialStatus = 200) {
20 const path = '/api/v1/accounts/' + accountId + '/video-channels' 20 const path = '/api/v1/accounts/' + accountName + '/video-channels'
21 21
22 return request(url) 22 return request(url)
23 .get(path) 23 .get(path)
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 07c4ffc77..46fa5f79d 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -167,8 +167,8 @@ function getMyVideos (url: string, accessToken: string, start: number, count: nu
167 .expect('Content-Type', /json/) 167 .expect('Content-Type', /json/)
168} 168}
169 169
170function getAccountVideos (url: string, accessToken: string, accountId: number | string, start: number, count: number, sort?: string) { 170function getAccountVideos (url: string, accessToken: string, accountName: string, start: number, count: number, sort?: string) {
171 const path = '/api/v1/accounts/' + accountId + '/videos' 171 const path = '/api/v1/accounts/' + accountName + '/videos'
172 172
173 return makeGetRequest({ 173 return makeGetRequest({
174 url, 174 url,