X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fusers%2Fusers-command.ts;h=90c5f218340aefe38c9764f41761be7a6d077ab6;hb=a37e9e74ff07b057370d1ed6c0b391a02be8a6d2;hp=ddd20d041805d18d4ab8c27fb644ec601ddf8cb9;hpb=421ff4618da64f0849353383f690a014024c40da;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/users/users-command.ts b/shared/extra-utils/users/users-command.ts index ddd20d041..90c5f2183 100644 --- a/shared/extra-utils/users/users-command.ts +++ b/shared/extra-utils/users/users-command.ts @@ -191,9 +191,9 @@ export class UsersCommand extends AbstractCommand { })).then(res => res.user) } - async generate (username: string) { + async generate (username: string, role?: UserRole) { const password = 'password' - const user = await this.create({ username, password }) + const user = await this.create({ username, password, role }) const token = await this.server.login.getAccessToken({ username, password }) @@ -202,13 +202,14 @@ export class UsersCommand extends AbstractCommand { return { token, userId: user.id, - userChannelId: me.videoChannels[0].id + userChannelId: me.videoChannels[0].id, + userChannelName: me.videoChannels[0].name } } - async generateUserAndToken (username: string) { + async generateUserAndToken (username: string, role?: UserRole) { const password = 'password' - await this.create({ username, password }) + await this.create({ username, password, role }) return this.server.login.getAccessToken({ username, password }) }