diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-11 14:41:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-11 15:16:39 +0100 |
commit | 7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88 (patch) | |
tree | ed94c1fb00a85a1f25c15b9a82831f4999e72948 /server/tests | |
parent | 6913f69134947432a192890b2de7c2d48094e85c (diff) | |
download | PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.tar.gz PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.tar.zst PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.zip |
Add originallyPublishedAt unit tests
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/videos.ts | 16 | ||||
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 6 |
2 files changed, 20 insertions, 2 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 878ffe025..3eccaee44 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts | |||
@@ -185,7 +185,8 @@ describe('Test videos API validator', function () { | |||
185 | support: 'my super support text', | 185 | support: 'my super support text', |
186 | tags: [ 'tag1', 'tag2' ], | 186 | tags: [ 'tag1', 'tag2' ], |
187 | privacy: VideoPrivacy.PUBLIC, | 187 | privacy: VideoPrivacy.PUBLIC, |
188 | channelId: channelId | 188 | channelId: channelId, |
189 | originallyPublishedAt: new Date().toISOString() | ||
189 | } | 190 | } |
190 | }) | 191 | }) |
191 | 192 | ||
@@ -313,6 +314,13 @@ describe('Test videos API validator', function () { | |||
313 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 314 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
314 | }) | 315 | }) |
315 | 316 | ||
317 | it('Should fail with a bad originally published at attribute', async function () { | ||
318 | const fields = immutableAssign(baseCorrectParams, { 'originallyPublishedAt': 'toto' }) | ||
319 | const attaches = baseCorrectAttaches | ||
320 | |||
321 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | ||
322 | }) | ||
323 | |||
316 | it('Should fail without an input file', async function () { | 324 | it('Should fail without an input file', async function () { |
317 | const fields = baseCorrectParams | 325 | const fields = baseCorrectParams |
318 | const attaches = {} | 326 | const attaches = {} |
@@ -534,6 +542,12 @@ describe('Test videos API validator', function () { | |||
534 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) | 542 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) |
535 | }) | 543 | }) |
536 | 544 | ||
545 | it('Should fail with a bad originally published at param', async function () { | ||
546 | const fields = immutableAssign(baseCorrectParams, { originallyPublishedAt: 'toto' }) | ||
547 | |||
548 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) | ||
549 | }) | ||
550 | |||
537 | it('Should fail with an incorrect thumbnail file', async function () { | 551 | it('Should fail with an incorrect thumbnail file', async function () { |
538 | const fields = baseCorrectParams | 552 | const fields = baseCorrectParams |
539 | const attaches = { | 553 | const attaches = { |
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 1b471ba79..7e2fcb630 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -98,6 +98,7 @@ describe('Test multiple servers', function () { | |||
98 | nsfw: true, | 98 | nsfw: true, |
99 | description: 'my super description for server 1', | 99 | description: 'my super description for server 1', |
100 | support: 'my super support text for server 1', | 100 | support: 'my super support text for server 1', |
101 | originallyPublishedAt: '2019-02-10T13:38:14.449Z', | ||
101 | tags: [ 'tag1p1', 'tag2p1' ], | 102 | tags: [ 'tag1p1', 'tag2p1' ], |
102 | channelId: videoChannelId, | 103 | channelId: videoChannelId, |
103 | fixture: 'video_short1.webm' | 104 | fixture: 'video_short1.webm' |
@@ -118,6 +119,7 @@ describe('Test multiple servers', function () { | |||
118 | nsfw: true, | 119 | nsfw: true, |
119 | description: 'my super description for server 1', | 120 | description: 'my super description for server 1', |
120 | support: 'my super support text for server 1', | 121 | support: 'my super support text for server 1', |
122 | originallyPublishedAt: '2019-02-10T13:38:14.449Z', | ||
121 | account: { | 123 | account: { |
122 | name: 'root', | 124 | name: 'root', |
123 | host: 'localhost:9001' | 125 | host: 'localhost:9001' |
@@ -625,6 +627,7 @@ describe('Test multiple servers', function () { | |||
625 | support: 'my super support text updated', | 627 | support: 'my super support text updated', |
626 | tags: [ 'tag_up_1', 'tag_up_2' ], | 628 | tags: [ 'tag_up_1', 'tag_up_2' ], |
627 | thumbnailfile: 'thumbnail.jpg', | 629 | thumbnailfile: 'thumbnail.jpg', |
630 | originallyPublishedAt: '2019-02-11T13:38:14.449Z', | ||
628 | previewfile: 'preview.jpg' | 631 | previewfile: 'preview.jpg' |
629 | } | 632 | } |
630 | 633 | ||
@@ -652,6 +655,7 @@ describe('Test multiple servers', function () { | |||
652 | nsfw: true, | 655 | nsfw: true, |
653 | description: 'my super description updated', | 656 | description: 'my super description updated', |
654 | support: 'my super support text updated', | 657 | support: 'my super support text updated', |
658 | originallyPublishedAt: '2019-02-11T13:38:14.449Z', | ||
655 | account: { | 659 | account: { |
656 | name: 'root', | 660 | name: 'root', |
657 | host: 'localhost:9003' | 661 | host: 'localhost:9003' |
@@ -983,7 +987,7 @@ describe('Test multiple servers', function () { | |||
983 | isLocal, | 987 | isLocal, |
984 | duration: 5, | 988 | duration: 5, |
985 | commentsEnabled: false, | 989 | commentsEnabled: false, |
986 | downloadEnabled: false, | 990 | downloadEnabled: true, |
987 | tags: [ ], | 991 | tags: [ ], |
988 | privacy: VideoPrivacy.PUBLIC, | 992 | privacy: VideoPrivacy.PUBLIC, |
989 | channel: { | 993 | channel: { |