- describe('My videos & quotas', function () {
-
- it('Should be able to upload a video with this user', async function () {
- this.timeout(10000)
-
- const videoAttributes = {
- name: 'super user video',
- fixture: 'video_short.webm'
- }
- await uploadVideo(server.url, accessTokenUser, videoAttributes)
- })
-
- it('Should have video quota updated', async function () {
- const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser)
- const data = res.body
-
- expect(data.videoQuotaUsed).to.equal(218910)
-
- const resUsers = await getUsersList(server.url, server.accessToken)
-
- const users: User[] = resUsers.body.data
- const tmpUser = users.find(u => u.username === user.username)
- expect(tmpUser.videoQuotaUsed).to.equal(218910)
- })
-
- it('Should be able to list my videos', async function () {
- const res = await getMyVideos(server.url, accessTokenUser, 0, 5)
- expect(res.body.total).to.equal(1)
-
- const videos = res.body.data
- expect(videos).to.have.lengthOf(1)
-
- const video: Video = videos[0]
- expect(video.name).to.equal('super user video')
- expect(video.thumbnailPath).to.not.be.null
- expect(video.previewPath).to.not.be.null
- })
-
- it('Should be able to search in my videos', async function () {
- {
- const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'user video')
- expect(res.body.total).to.equal(1)
-
- const videos = res.body.data
- expect(videos).to.have.lengthOf(1)
- }
-
- {
- const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'toto')
- expect(res.body.total).to.equal(0)
-
- const videos = res.body.data
- expect(videos).to.have.lengthOf(0)
- }
- })
-
- it('Should disable webtorrent, enable HLS, and update my quota', async function () {
- this.timeout(60000)
-
- {
- const res = await getCustomConfig(server.url, server.accessToken)
- const config = res.body as CustomConfig
- config.transcoding.webtorrent.enabled = false
- config.transcoding.hls.enabled = true
- config.transcoding.enabled = true
- await updateCustomSubConfig(server.url, server.accessToken, config)
- }
-
- {
- const videoAttributes = {
- name: 'super user video 2',
- fixture: 'video_short.webm'
- }
- await uploadVideo(server.url, accessTokenUser, videoAttributes)
-
- await waitJobs([ server ])
- }
-
- {
- const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser)
- const data = res.body
-
- expect(data.videoQuotaUsed).to.be.greaterThan(220000)
- }
- })
- })
-