Rename captions commands
This commit is contained in:
parent
4d029ef8ec
commit
c63830f154
|
@ -1,6 +1,6 @@
|
||||||
export * from './form-validator.model'
|
export * from './form-validator.model'
|
||||||
|
|
||||||
// Don't re export const variables because webpack 4 cannot do tree shaking with them
|
// Don't re export const variables because webpack cannot do tree shaking with them
|
||||||
// export * from './abuse-validators'
|
// export * from './abuse-validators'
|
||||||
// export * from './batch-domains-validators'
|
// export * from './batch-domains-validators'
|
||||||
// export * from './custom-config-validators'
|
// export * from './custom-config-validators'
|
||||||
|
|
|
@ -232,7 +232,7 @@ async function prepare () {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) {
|
for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) {
|
||||||
await server.captions.createVideoCaption({
|
await server.captions.add({
|
||||||
language: caption,
|
language: caption,
|
||||||
videoId: video.id,
|
videoId: video.id,
|
||||||
fixture: 'subtitle-good2.vtt'
|
fixture: 'subtitle-good2.vtt'
|
||||||
|
|
|
@ -151,7 +151,7 @@ describe('Test video captions API validator', function () {
|
||||||
// })
|
// })
|
||||||
|
|
||||||
it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () {
|
it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () {
|
||||||
await server.captions.createVideoCaption({
|
await server.captions.add({
|
||||||
language: 'zh',
|
language: 'zh',
|
||||||
videoId: video.uuid,
|
videoId: video.uuid,
|
||||||
fixture: 'subtitle-good.srt',
|
fixture: 'subtitle-good.srt',
|
||||||
|
|
|
@ -50,14 +50,14 @@ describe('Test videos search', function () {
|
||||||
const { id, uuid } = await server.videos.upload({ attributes: attributes3 })
|
const { id, uuid } = await server.videos.upload({ attributes: attributes3 })
|
||||||
videoUUID = uuid
|
videoUUID = uuid
|
||||||
|
|
||||||
await server.captions.createVideoCaption({
|
await server.captions.add({
|
||||||
language: 'en',
|
language: 'en',
|
||||||
videoId: id,
|
videoId: id,
|
||||||
fixture: 'subtitle-good2.vtt',
|
fixture: 'subtitle-good2.vtt',
|
||||||
mimeType: 'application/octet-stream'
|
mimeType: 'application/octet-stream'
|
||||||
})
|
})
|
||||||
|
|
||||||
await server.captions.createVideoCaption({
|
await server.captions.add({
|
||||||
language: 'aa',
|
language: 'aa',
|
||||||
videoId: id,
|
videoId: id,
|
||||||
fixture: 'subtitle-good2.vtt',
|
fixture: 'subtitle-good2.vtt',
|
||||||
|
|
|
@ -416,7 +416,7 @@ describe('Test follows', function () {
|
||||||
await servers[2].comments.delete({ videoId: video4.id, commentId: replyId })
|
await servers[2].comments.delete({ videoId: video4.id, commentId: replyId })
|
||||||
}
|
}
|
||||||
|
|
||||||
await servers[2].captions.createVideoCaption({
|
await servers[2].captions.add({
|
||||||
language: 'ar',
|
language: 'ar',
|
||||||
videoId: video4.id,
|
videoId: video4.id,
|
||||||
fixture: 'subtitle-good2.vtt'
|
fixture: 'subtitle-good2.vtt'
|
||||||
|
@ -569,7 +569,7 @@ describe('Test follows', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should have propagated captions', async function () {
|
it('Should have propagated captions', async function () {
|
||||||
const body = await servers[0].captions.listVideoCaptions({ videoId: video4.id })
|
const body = await servers[0].captions.list({ videoId: video4.id })
|
||||||
expect(body.total).to.equal(1)
|
expect(body.total).to.equal(1)
|
||||||
expect(body.data).to.have.lengthOf(1)
|
expect(body.data).to.have.lengthOf(1)
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ describe('Test video captions', function () {
|
||||||
|
|
||||||
it('Should list the captions and return an empty list', async function () {
|
it('Should list the captions and return an empty list', async function () {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
|
const body = await server.captions.list({ videoId: videoUUID })
|
||||||
expect(body.total).to.equal(0)
|
expect(body.total).to.equal(0)
|
||||||
expect(body.data).to.have.lengthOf(0)
|
expect(body.data).to.have.lengthOf(0)
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,13 @@ describe('Test video captions', function () {
|
||||||
it('Should create two new captions', async function () {
|
it('Should create two new captions', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(30000)
|
||||||
|
|
||||||
await servers[0].captions.createVideoCaption({
|
await servers[0].captions.add({
|
||||||
language: 'ar',
|
language: 'ar',
|
||||||
videoId: videoUUID,
|
videoId: videoUUID,
|
||||||
fixture: 'subtitle-good1.vtt'
|
fixture: 'subtitle-good1.vtt'
|
||||||
})
|
})
|
||||||
|
|
||||||
await servers[0].captions.createVideoCaption({
|
await servers[0].captions.add({
|
||||||
language: 'zh',
|
language: 'zh',
|
||||||
videoId: videoUUID,
|
videoId: videoUUID,
|
||||||
fixture: 'subtitle-good2.vtt',
|
fixture: 'subtitle-good2.vtt',
|
||||||
|
@ -67,7 +67,7 @@ describe('Test video captions', function () {
|
||||||
|
|
||||||
it('Should list these uploaded captions', async function () {
|
it('Should list these uploaded captions', async function () {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
|
const body = await server.captions.list({ videoId: videoUUID })
|
||||||
expect(body.total).to.equal(2)
|
expect(body.total).to.equal(2)
|
||||||
expect(body.data).to.have.lengthOf(2)
|
expect(body.data).to.have.lengthOf(2)
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ describe('Test video captions', function () {
|
||||||
it('Should replace an existing caption', async function () {
|
it('Should replace an existing caption', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(30000)
|
||||||
|
|
||||||
await servers[0].captions.createVideoCaption({
|
await servers[0].captions.add({
|
||||||
language: 'ar',
|
language: 'ar',
|
||||||
videoId: videoUUID,
|
videoId: videoUUID,
|
||||||
fixture: 'subtitle-good2.vtt'
|
fixture: 'subtitle-good2.vtt'
|
||||||
|
@ -99,7 +99,7 @@ describe('Test video captions', function () {
|
||||||
|
|
||||||
it('Should have this caption updated', async function () {
|
it('Should have this caption updated', async function () {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
|
const body = await server.captions.list({ videoId: videoUUID })
|
||||||
expect(body.total).to.equal(2)
|
expect(body.total).to.equal(2)
|
||||||
expect(body.data).to.have.lengthOf(2)
|
expect(body.data).to.have.lengthOf(2)
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ describe('Test video captions', function () {
|
||||||
it('Should replace an existing caption with a srt file and convert it', async function () {
|
it('Should replace an existing caption with a srt file and convert it', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(30000)
|
||||||
|
|
||||||
await servers[0].captions.createVideoCaption({
|
await servers[0].captions.add({
|
||||||
language: 'ar',
|
language: 'ar',
|
||||||
videoId: videoUUID,
|
videoId: videoUUID,
|
||||||
fixture: 'subtitle-good.srt'
|
fixture: 'subtitle-good.srt'
|
||||||
|
@ -128,7 +128,7 @@ describe('Test video captions', function () {
|
||||||
|
|
||||||
it('Should have this caption updated and converted', async function () {
|
it('Should have this caption updated and converted', async function () {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
|
const body = await server.captions.list({ videoId: videoUUID })
|
||||||
expect(body.total).to.equal(2)
|
expect(body.total).to.equal(2)
|
||||||
expect(body.data).to.have.lengthOf(2)
|
expect(body.data).to.have.lengthOf(2)
|
||||||
|
|
||||||
|
@ -157,14 +157,14 @@ describe('Test video captions', function () {
|
||||||
it('Should remove one caption', async function () {
|
it('Should remove one caption', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(30000)
|
||||||
|
|
||||||
await servers[0].captions.deleteVideoCaption({ videoId: videoUUID, language: 'ar' })
|
await servers[0].captions.delete({ videoId: videoUUID, language: 'ar' })
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should only list the caption that was not deleted', async function () {
|
it('Should only list the caption that was not deleted', async function () {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
|
const body = await server.captions.list({ videoId: videoUUID })
|
||||||
expect(body.total).to.equal(1)
|
expect(body.total).to.equal(1)
|
||||||
expect(body.data).to.have.lengthOf(1)
|
expect(body.data).to.have.lengthOf(1)
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ describe('Test video imports', function () {
|
||||||
expect(videoTorrent.name).to.contain('你好 世界 720p.mp4')
|
expect(videoTorrent.name).to.contain('你好 世界 720p.mp4')
|
||||||
expect(videoMagnet.name).to.contain('super peertube2 video')
|
expect(videoMagnet.name).to.contain('super peertube2 video')
|
||||||
|
|
||||||
const bodyCaptions = await server.captions.listVideoCaptions({ videoId: idHttp })
|
const bodyCaptions = await server.captions.list({ videoId: idHttp })
|
||||||
expect(bodyCaptions.total).to.equal(2)
|
expect(bodyCaptions.total).to.equal(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ describe('Test video imports', function () {
|
||||||
|
|
||||||
expect(video.files).to.have.lengthOf(1)
|
expect(video.files).to.have.lengthOf(1)
|
||||||
|
|
||||||
const bodyCaptions = await server.captions.listVideoCaptions({ videoId: id })
|
const bodyCaptions = await server.captions.list({ videoId: id })
|
||||||
expect(bodyCaptions.total).to.equal(2)
|
expect(bodyCaptions.total).to.equal(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ describe('Test video imports', function () {
|
||||||
await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath)
|
await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath)
|
||||||
await testImage(servers[0].url, 'video_import_preview', video.previewPath)
|
await testImage(servers[0].url, 'video_import_preview', video.previewPath)
|
||||||
|
|
||||||
const bodyCaptions = await servers[0].captions.listVideoCaptions({ videoId: video.id })
|
const bodyCaptions = await servers[0].captions.list({ videoId: video.id })
|
||||||
const videoCaptions = bodyCaptions.data
|
const videoCaptions = bodyCaptions.data
|
||||||
expect(videoCaptions).to.have.lengthOf(2)
|
expect(videoCaptions).to.have.lengthOf(2)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
||||||
|
|
||||||
export class CaptionsCommand extends AbstractCommand {
|
export class CaptionsCommand extends AbstractCommand {
|
||||||
|
|
||||||
createVideoCaption (options: OverrideCommandOptions & {
|
add (options: OverrideCommandOptions & {
|
||||||
videoId: string | number
|
videoId: string | number
|
||||||
language: string
|
language: string
|
||||||
fixture: string
|
fixture: string
|
||||||
|
@ -32,7 +32,7 @@ export class CaptionsCommand extends AbstractCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
listVideoCaptions (options: OverrideCommandOptions & {
|
list (options: OverrideCommandOptions & {
|
||||||
videoId: string | number
|
videoId: string | number
|
||||||
}) {
|
}) {
|
||||||
const { videoId } = options
|
const { videoId } = options
|
||||||
|
@ -47,7 +47,7 @@ export class CaptionsCommand extends AbstractCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteVideoCaption (options: OverrideCommandOptions & {
|
delete (options: OverrideCommandOptions & {
|
||||||
videoId: string | number
|
videoId: string | number
|
||||||
language: string
|
language: string
|
||||||
}) {
|
}) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ export class CommentsCommand extends AbstractCommand {
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
}))
|
}))
|
||||||
|
|
||||||
this.lastThreadId = body.comment.id
|
this.lastThreadId = body.comment?.id
|
||||||
this.lastVideoId = videoId
|
this.lastVideoId = videoId
|
||||||
|
|
||||||
return body.comment
|
return body.comment
|
||||||
|
@ -107,7 +107,7 @@ export class CommentsCommand extends AbstractCommand {
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
}))
|
}))
|
||||||
|
|
||||||
this.lastReplyId = body.comment.id
|
this.lastReplyId = body.comment?.id
|
||||||
|
|
||||||
return body.comment
|
return body.comment
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue