/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
-import { testImage } from '@server/tests/shared'
+import { testImageSize } from '@server/tests/shared'
import { AbuseState, HttpStatusCode, UserAdminFlag, UserRole, VideoPlaylistType } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
const user = await server.users.getMyInfo({ token: userToken })
for (const avatar of user.account.avatars) {
- await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.gif')
+ await testImageSize(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.gif')
}
})
const user = await server.users.getMyInfo({ token: userToken })
for (const avatar of user.account.avatars) {
- await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, extension)
+ await testImageSize(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, extension)
}
}
})
})
})
- describe('Registering a new user', function () {
- let user15AccessToken: string
-
- it('Should register a new user', async function () {
- const user = { displayName: 'super user 15', username: 'user_15', password: 'my super password' }
- const channel = { name: 'my_user_15_channel', displayName: 'my channel rocks' }
-
- await server.users.register({ ...user, channel })
- })
-
- it('Should be able to login with this registered user', async function () {
- const user15 = {
- username: 'user_15',
- password: 'my super password'
- }
-
- user15AccessToken = await server.login.getAccessToken(user15)
- })
-
- it('Should have the correct display name', async function () {
- const user = await server.users.getMyInfo({ token: user15AccessToken })
- expect(user.account.displayName).to.equal('super user 15')
- })
-
- it('Should have the correct video quota', async function () {
- const user = await server.users.getMyInfo({ token: user15AccessToken })
- expect(user.videoQuota).to.equal(5 * 1024 * 1024)
- })
-
- it('Should have created the channel', async function () {
- const { displayName } = await server.channels.get({ channelName: 'my_user_15_channel' })
-
- expect(displayName).to.equal('my channel rocks')
- })
-
- it('Should remove me', async function () {
- {
- const { data } = await server.users.list()
- expect(data.find(u => u.username === 'user_15')).to.not.be.undefined
- }
-
- await server.users.deleteMe({ token: user15AccessToken })
-
- {
- const { data } = await server.users.list()
- expect(data.find(u => u.username === 'user_15')).to.be.undefined
- }
- })
- })
-
describe('User blocking', function () {
let user16Id: number
let user16AccessToken: string