1
0
Fork 0

Test video attribute "importedFrom"

This commit is contained in:
Alex Kotov 2023-05-27 18:07:57 +04:00
parent 4949040b1a
commit b22e5fceb4
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 19 additions and 0 deletions

View File

@ -202,6 +202,7 @@ describe('Test videos API validator', function () {
tags: [ 'tag1', 'tag2' ],
privacy: VideoPrivacy.PUBLIC,
channelId,
importedFrom: 'https://youtu.be/fe8agy1pb44',
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)
})
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 () {
const fields = { ...baseCorrectParams, originallyPublishedAt: 'toto' }
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 })
})
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 () {
const fields = { ...baseCorrectParams, originallyPublishedAt: 'toto' }

View File

@ -25,6 +25,7 @@ async function completeVideoCheck (
description: string
publishedAt?: string
support: string
importedFrom?: string
originallyPublishedAt?: string
account: {
name: string
@ -86,6 +87,12 @@ async function completeVideoCheck (
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) {
expect(video.originallyPublishedAt).to.equal(attributes.originallyPublishedAt)
} else {