mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Add job queue hooks
This commit is contained in:
@@ -632,6 +632,51 @@ describe('Test plugin filter hooks', function () {
|
||||
|
||||
})
|
||||
|
||||
describe('Job queue filters', function () {
|
||||
let videoUUID: string
|
||||
|
||||
before(async function () {
|
||||
this.timeout(120_000)
|
||||
|
||||
const { uuid } = await servers[0].videos.quickUpload({ name: 'studio' })
|
||||
|
||||
const video = await servers[0].videos.get({ id: uuid })
|
||||
expect(video.duration).at.least(2)
|
||||
videoUUID = video.uuid
|
||||
|
||||
await waitJobs(servers)
|
||||
|
||||
await servers[0].config.enableStudio()
|
||||
})
|
||||
|
||||
it('Should run filter:job-queue.process.params', async function () {
|
||||
this.timeout(120_000)
|
||||
|
||||
await servers[0].videoStudio.createEditionTasks({
|
||||
videoId: videoUUID,
|
||||
tasks: [
|
||||
{
|
||||
name: 'add-intro',
|
||||
options: {
|
||||
file: 'video_very_short_240p.mp4'
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
await waitJobs(servers)
|
||||
|
||||
await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.params', 1, false)
|
||||
|
||||
const video = await servers[0].videos.get({ id: videoUUID })
|
||||
expect(video.duration).at.most(2)
|
||||
})
|
||||
|
||||
it('Should run filter:job-queue.process.result', async function () {
|
||||
await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.result', 1, false)
|
||||
})
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
await cleanupTests(servers)
|
||||
})
|
||||
|
||||
@@ -110,6 +110,7 @@ describe('Test plugin helpers', function () {
|
||||
})
|
||||
|
||||
describe('User', function () {
|
||||
let rootId: number
|
||||
|
||||
it('Should not get a user if not authenticated', async function () {
|
||||
await makeGetRequest({
|
||||
@@ -132,6 +133,28 @@ describe('Test plugin helpers', function () {
|
||||
expect(res.body.isAdmin).to.be.true
|
||||
expect(res.body.isModerator).to.be.false
|
||||
expect(res.body.isUser).to.be.false
|
||||
|
||||
rootId = res.body.id
|
||||
})
|
||||
|
||||
it('Should load a user by id', async function () {
|
||||
{
|
||||
const res = await makeGetRequest({
|
||||
url: servers[0].url,
|
||||
path: '/plugins/test-four/router/user/' + rootId,
|
||||
expectedStatus: HttpStatusCode.OK_200
|
||||
})
|
||||
|
||||
expect(res.body.username).to.equal('root')
|
||||
}
|
||||
|
||||
{
|
||||
await makeGetRequest({
|
||||
url: servers[0].url,
|
||||
path: '/plugins/test-four/router/user/42',
|
||||
expectedStatus: HttpStatusCode.NOT_FOUND_404
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user