import 'mocha'
import * as chai from 'chai'
+import { testImage } from '@server/tests/shared'
+import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
import {
cleanupTests,
createSingleServer,
makePutBodyRequest,
PeerTubeServer,
setAccessTokensToServers,
- testImage,
waitJobs
-} from '@shared/extra-utils'
-import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
+} from '@shared/server-commands'
const expect = chai.expect
})
it('Should have an expired access token', async function () {
- this.timeout(15000)
+ this.timeout(60000)
await server.sql.setTokenField(server.accessToken, 'accessTokenExpiresAt', new Date().toISOString())
await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())
})
it('Should disable webtorrent, enable HLS, and update my quota', async function () {
- this.timeout(60000)
+ this.timeout(160000)
{
const config = await server.config.getCustomConfig()
expect(user.autoPlayNextVideo).to.be.true
})
+ it('Should be able to change the p2p attribute', async function () {
+ {
+ await server.users.updateMe({
+ token: userToken,
+ webTorrentEnabled: false
+ })
+
+ const user = await server.users.getMyInfo({ token: userToken })
+ expect(user.p2pEnabled).to.be.false
+ }
+
+ {
+ await server.users.updateMe({
+ token: userToken,
+ p2pEnabled: true
+ })
+
+ const user = await server.users.getMyInfo({ token: userToken })
+ expect(user.p2pEnabled).to.be.true
+ }
+ })
+
it('Should be able to change the email attribute', async function () {
await server.users.updateMe({
token: userToken,
await server.users.updateMyAvatar({ token: userToken, fixture })
const user = await server.users.getMyInfo({ token: userToken })
- await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.gif')
+ for (const avatar of user.account.avatars) {
+ await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, '.gif')
+ }
})
it('Should be able to update my avatar with a gif, and then a png', async function () {
await server.users.updateMyAvatar({ token: userToken, fixture })
const user = await server.users.getMyInfo({ token: userToken })
- await testImage(server.url, 'avatar-resized', user.account.avatar.path, extension)
+ for (const avatar of user.account.avatars) {
+ await testImage(server.url, `avatar-resized-${avatar.width}x${avatar.width}`, avatar.path, extension)
+ }
}
})
+ it('Should still have the same amount of videos in my account', async function () {
+ const { total, data } = await server.videos.listMyVideos({ token: userToken })
+
+ expect(total).to.equal(2)
+ expect(data).to.have.lengthOf(2)
+ })
+
it('Should be able to update my display name', async function () {
await server.users.updateMe({ token: userToken, displayName: 'new display name' })