Test video attribute "importedFrom"
This commit is contained in:
parent
4949040b1a
commit
b22e5fceb4
|
@ -202,6 +202,7 @@ describe('Test videos API validator', function () {
|
||||||
tags: [ 'tag1', 'tag2' ],
|
tags: [ 'tag1', 'tag2' ],
|
||||||
privacy: VideoPrivacy.PUBLIC,
|
privacy: VideoPrivacy.PUBLIC,
|
||||||
channelId,
|
channelId,
|
||||||
|
importedFrom: 'https://youtu.be/fe8agy1pb44',
|
||||||
originallyPublishedAt: new Date().toISOString()
|
originallyPublishedAt: new Date().toISOString()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -336,6 +337,12 @@ describe('Test videos API validator', function () {
|
||||||
await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
|
await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should fail with a bad URL where the video is imported from', async function () {
|
||||||
|
const fields = { ...baseCorrectParams, importedFrom: 'to' }
|
||||||
|
const attaches = baseCorrectAttaches
|
||||||
|
await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
|
||||||
|
})
|
||||||
|
|
||||||
it('Should fail with a bad originally published at attribute', async function () {
|
it('Should fail with a bad originally published at attribute', async function () {
|
||||||
const fields = { ...baseCorrectParams, originallyPublishedAt: 'toto' }
|
const fields = { ...baseCorrectParams, originallyPublishedAt: 'toto' }
|
||||||
const attaches = baseCorrectAttaches
|
const attaches = baseCorrectAttaches
|
||||||
|
@ -590,6 +597,11 @@ describe('Test videos API validator', function () {
|
||||||
await makePutBodyRequest({ url: server.url, path: path + video.shortUUID, token: server.accessToken, fields })
|
await makePutBodyRequest({ url: server.url, path: path + video.shortUUID, token: server.accessToken, fields })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should fail with a bad URL where the video is imported from', async function () {
|
||||||
|
const fields = { ...baseCorrectParams, importedFrom: 'to' }
|
||||||
|
await makePutBodyRequest({ url: server.url, path: path + video.shortUUID, token: server.accessToken, fields })
|
||||||
|
})
|
||||||
|
|
||||||
it('Should fail with a bad originally published at param', async function () {
|
it('Should fail with a bad originally published at param', async function () {
|
||||||
const fields = { ...baseCorrectParams, originallyPublishedAt: 'toto' }
|
const fields = { ...baseCorrectParams, originallyPublishedAt: 'toto' }
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ async function completeVideoCheck (
|
||||||
description: string
|
description: string
|
||||||
publishedAt?: string
|
publishedAt?: string
|
||||||
support: string
|
support: string
|
||||||
|
importedFrom?: string
|
||||||
originallyPublishedAt?: string
|
originallyPublishedAt?: string
|
||||||
account: {
|
account: {
|
||||||
name: string
|
name: string
|
||||||
|
@ -86,6 +87,12 @@ async function completeVideoCheck (
|
||||||
expect(video.publishedAt).to.equal(attributes.publishedAt)
|
expect(video.publishedAt).to.equal(attributes.publishedAt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (attributes.importedFrom) {
|
||||||
|
expect(video.importedFrom).to.equal(attributes.importedFrom)
|
||||||
|
} else {
|
||||||
|
expect(video.importedFrom).to.be.null
|
||||||
|
}
|
||||||
|
|
||||||
if (attributes.originallyPublishedAt) {
|
if (attributes.originallyPublishedAt) {
|
||||||
expect(video.originallyPublishedAt).to.equal(attributes.originallyPublishedAt)
|
expect(video.originallyPublishedAt).to.equal(attributes.originallyPublishedAt)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue