Add video file update hook tests

This commit is contained in:
Chocobozzz
2023-07-25 15:17:58 +02:00
parent 3b46eec8ae
commit 9901c8d690
5 changed files with 61 additions and 16 deletions

View File

@@ -40,6 +40,8 @@ describe('Test plugin action hooks', function () {
}
})
await servers[0].config.enableFileUpdate()
await doubleFollow(servers[0], servers[1])
})
@@ -70,6 +72,12 @@ describe('Test plugin action hooks', function () {
await checkHook('action:api.video.viewed')
})
it('Should run action:api.video.file-updated', async function () {
await servers[0].videos.replaceSourceFile({ videoId: videoUUID, fixture: 'video_short.mp4' })
await checkHook('action:api.video.file-updated')
})
it('Should run action:api.video.deleted', async function () {
await servers[0].videos.remove({ id: videoUUID })

View File

@@ -64,6 +64,11 @@ describe('Test plugin filter hooks', function () {
newConfig: {
live: { enabled: true },
signup: { enabled: true },
videoFile: {
update: {
enabled: true
}
},
import: {
videos: {
http: { enabled: true },
@@ -178,7 +183,19 @@ describe('Test plugin filter hooks', function () {
describe('Video/live/import accept', function () {
it('Should run filter:api.video.upload.accept.result', async function () {
await servers[0].videos.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
const options = { attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }
await servers[0].videos.upload({ mode: 'legacy', ...options })
await servers[0].videos.upload({ mode: 'resumable', ...options })
})
it('Should run filter:api.video.update-file.accept.result', async function () {
const res = await servers[0].videos.replaceSourceFile({
videoId: videoUUID,
fixture: 'video_short1.webm',
completedExpectedStatus: HttpStatusCode.FORBIDDEN_403
})
expect((res as any)?.error).to.equal('no webm')
})
it('Should run filter:api.live-video.create.accept.result', async function () {