aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-21 13:58:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-21 13:58:35 +0200
commitc63830f15403ac4e750829f27d8bbbdc9a59282c (patch)
treef35048f1b2249bb3eec916964c084b1cd60f7bf3
parent4d029ef8ec3d5274eeaa3ee6d808eb7035e7faef (diff)
downloadPeerTube-c63830f15403ac4e750829f27d8bbbdc9a59282c.tar.gz
PeerTube-c63830f15403ac4e750829f27d8bbbdc9a59282c.tar.zst
PeerTube-c63830f15403ac4e750829f27d8bbbdc9a59282c.zip
Rename captions commands
-rw-r--r--client/src/app/shared/form-validators/index.ts2
-rw-r--r--scripts/benchmark.ts2
-rw-r--r--server/tests/api/check-params/video-captions.ts2
-rw-r--r--server/tests/api/search/search-videos.ts4
-rw-r--r--server/tests/api/server/follows.ts4
-rw-r--r--server/tests/api/videos/video-captions.ts20
-rw-r--r--server/tests/api/videos/video-imports.ts6
-rw-r--r--shared/extra-utils/videos/captions-command.ts6
-rw-r--r--shared/extra-utils/videos/comments-command.ts4
9 files changed, 25 insertions, 25 deletions
diff --git a/client/src/app/shared/form-validators/index.ts b/client/src/app/shared/form-validators/index.ts
index c14272a2a..0b605719c 100644
--- a/client/src/app/shared/form-validators/index.ts
+++ b/client/src/app/shared/form-validators/index.ts
@@ -1,6 +1,6 @@
1export * from './form-validator.model' 1export * from './form-validator.model'
2 2
3// Don't re export const variables because webpack 4 cannot do tree shaking with them 3// Don't re export const variables because webpack cannot do tree shaking with them
4// export * from './abuse-validators' 4// export * from './abuse-validators'
5// export * from './batch-domains-validators' 5// export * from './batch-domains-validators'
6// export * from './custom-config-validators' 6// export * from './custom-config-validators'
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts
index 071c4dea7..83b932909 100644
--- a/scripts/benchmark.ts
+++ b/scripts/benchmark.ts
@@ -232,7 +232,7 @@ async function prepare () {
232 } 232 }
233 233
234 for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) { 234 for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) {
235 await server.captions.createVideoCaption({ 235 await server.captions.add({
236 language: caption, 236 language: caption,
237 videoId: video.id, 237 videoId: video.id,
238 fixture: 'subtitle-good2.vtt' 238 fixture: 'subtitle-good2.vtt'
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 5aaeb27fe..90f429314 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -151,7 +151,7 @@ describe('Test video captions API validator', function () {
151 // }) 151 // })
152 152
153 it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () { 153 it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () {
154 await server.captions.createVideoCaption({ 154 await server.captions.add({
155 language: 'zh', 155 language: 'zh',
156 videoId: video.uuid, 156 videoId: video.uuid,
157 fixture: 'subtitle-good.srt', 157 fixture: 'subtitle-good.srt',
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index f834c7f36..965766742 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -50,14 +50,14 @@ describe('Test videos search', function () {
50 const { id, uuid } = await server.videos.upload({ attributes: attributes3 }) 50 const { id, uuid } = await server.videos.upload({ attributes: attributes3 })
51 videoUUID = uuid 51 videoUUID = uuid
52 52
53 await server.captions.createVideoCaption({ 53 await server.captions.add({
54 language: 'en', 54 language: 'en',
55 videoId: id, 55 videoId: id,
56 fixture: 'subtitle-good2.vtt', 56 fixture: 'subtitle-good2.vtt',
57 mimeType: 'application/octet-stream' 57 mimeType: 'application/octet-stream'
58 }) 58 })
59 59
60 await server.captions.createVideoCaption({ 60 await server.captions.add({
61 language: 'aa', 61 language: 'aa',
62 videoId: id, 62 videoId: id,
63 fixture: 'subtitle-good2.vtt', 63 fixture: 'subtitle-good2.vtt',
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index a616edcff..832ba561a 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -416,7 +416,7 @@ describe('Test follows', function () {
416 await servers[2].comments.delete({ videoId: video4.id, commentId: replyId }) 416 await servers[2].comments.delete({ videoId: video4.id, commentId: replyId })
417 } 417 }
418 418
419 await servers[2].captions.createVideoCaption({ 419 await servers[2].captions.add({
420 language: 'ar', 420 language: 'ar',
421 videoId: video4.id, 421 videoId: video4.id,
422 fixture: 'subtitle-good2.vtt' 422 fixture: 'subtitle-good2.vtt'
@@ -569,7 +569,7 @@ describe('Test follows', function () {
569 }) 569 })
570 570
571 it('Should have propagated captions', async function () { 571 it('Should have propagated captions', async function () {
572 const body = await servers[0].captions.listVideoCaptions({ videoId: video4.id }) 572 const body = await servers[0].captions.list({ videoId: video4.id })
573 expect(body.total).to.equal(1) 573 expect(body.total).to.equal(1)
574 expect(body.data).to.have.lengthOf(1) 574 expect(body.data).to.have.lengthOf(1)
575 575
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index e3d46e619..4c8e28adf 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -40,7 +40,7 @@ describe('Test video captions', function () {
40 40
41 it('Should list the captions and return an empty list', async function () { 41 it('Should list the captions and return an empty list', async function () {
42 for (const server of servers) { 42 for (const server of servers) {
43 const body = await server.captions.listVideoCaptions({ videoId: videoUUID }) 43 const body = await server.captions.list({ videoId: videoUUID })
44 expect(body.total).to.equal(0) 44 expect(body.total).to.equal(0)
45 expect(body.data).to.have.lengthOf(0) 45 expect(body.data).to.have.lengthOf(0)
46 } 46 }
@@ -49,13 +49,13 @@ describe('Test video captions', function () {
49 it('Should create two new captions', async function () { 49 it('Should create two new captions', async function () {
50 this.timeout(30000) 50 this.timeout(30000)
51 51
52 await servers[0].captions.createVideoCaption({ 52 await servers[0].captions.add({
53 language: 'ar', 53 language: 'ar',
54 videoId: videoUUID, 54 videoId: videoUUID,
55 fixture: 'subtitle-good1.vtt' 55 fixture: 'subtitle-good1.vtt'
56 }) 56 })
57 57
58 await servers[0].captions.createVideoCaption({ 58 await servers[0].captions.add({
59 language: 'zh', 59 language: 'zh',
60 videoId: videoUUID, 60 videoId: videoUUID,
61 fixture: 'subtitle-good2.vtt', 61 fixture: 'subtitle-good2.vtt',
@@ -67,7 +67,7 @@ describe('Test video captions', function () {
67 67
68 it('Should list these uploaded captions', async function () { 68 it('Should list these uploaded captions', async function () {
69 for (const server of servers) { 69 for (const server of servers) {
70 const body = await server.captions.listVideoCaptions({ videoId: videoUUID }) 70 const body = await server.captions.list({ videoId: videoUUID })
71 expect(body.total).to.equal(2) 71 expect(body.total).to.equal(2)
72 expect(body.data).to.have.lengthOf(2) 72 expect(body.data).to.have.lengthOf(2)
73 73
@@ -88,7 +88,7 @@ describe('Test video captions', function () {
88 it('Should replace an existing caption', async function () { 88 it('Should replace an existing caption', async function () {
89 this.timeout(30000) 89 this.timeout(30000)
90 90
91 await servers[0].captions.createVideoCaption({ 91 await servers[0].captions.add({
92 language: 'ar', 92 language: 'ar',
93 videoId: videoUUID, 93 videoId: videoUUID,
94 fixture: 'subtitle-good2.vtt' 94 fixture: 'subtitle-good2.vtt'
@@ -99,7 +99,7 @@ describe('Test video captions', function () {
99 99
100 it('Should have this caption updated', async function () { 100 it('Should have this caption updated', async function () {
101 for (const server of servers) { 101 for (const server of servers) {
102 const body = await server.captions.listVideoCaptions({ videoId: videoUUID }) 102 const body = await server.captions.list({ videoId: videoUUID })
103 expect(body.total).to.equal(2) 103 expect(body.total).to.equal(2)
104 expect(body.data).to.have.lengthOf(2) 104 expect(body.data).to.have.lengthOf(2)
105 105
@@ -114,7 +114,7 @@ describe('Test video captions', function () {
114 it('Should replace an existing caption with a srt file and convert it', async function () { 114 it('Should replace an existing caption with a srt file and convert it', async function () {
115 this.timeout(30000) 115 this.timeout(30000)
116 116
117 await servers[0].captions.createVideoCaption({ 117 await servers[0].captions.add({
118 language: 'ar', 118 language: 'ar',
119 videoId: videoUUID, 119 videoId: videoUUID,
120 fixture: 'subtitle-good.srt' 120 fixture: 'subtitle-good.srt'
@@ -128,7 +128,7 @@ describe('Test video captions', function () {
128 128
129 it('Should have this caption updated and converted', async function () { 129 it('Should have this caption updated and converted', async function () {
130 for (const server of servers) { 130 for (const server of servers) {
131 const body = await server.captions.listVideoCaptions({ videoId: videoUUID }) 131 const body = await server.captions.list({ videoId: videoUUID })
132 expect(body.total).to.equal(2) 132 expect(body.total).to.equal(2)
133 expect(body.data).to.have.lengthOf(2) 133 expect(body.data).to.have.lengthOf(2)
134 134
@@ -157,14 +157,14 @@ describe('Test video captions', function () {
157 it('Should remove one caption', async function () { 157 it('Should remove one caption', async function () {
158 this.timeout(30000) 158 this.timeout(30000)
159 159
160 await servers[0].captions.deleteVideoCaption({ videoId: videoUUID, language: 'ar' }) 160 await servers[0].captions.delete({ videoId: videoUUID, language: 'ar' })
161 161
162 await waitJobs(servers) 162 await waitJobs(servers)
163 }) 163 })
164 164
165 it('Should only list the caption that was not deleted', async function () { 165 it('Should only list the caption that was not deleted', async function () {
166 for (const server of servers) { 166 for (const server of servers) {
167 const body = await server.captions.listVideoCaptions({ videoId: videoUUID }) 167 const body = await server.captions.list({ videoId: videoUUID })
168 expect(body.total).to.equal(1) 168 expect(body.total).to.equal(1)
169 expect(body.data).to.have.lengthOf(1) 169 expect(body.data).to.have.lengthOf(1)
170 170
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 192f5232e..2eac130d2 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -59,7 +59,7 @@ describe('Test video imports', function () {
59 expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') 59 expect(videoTorrent.name).to.contain('你好 世界 720p.mp4')
60 expect(videoMagnet.name).to.contain('super peertube2 video') 60 expect(videoMagnet.name).to.contain('super peertube2 video')
61 61
62 const bodyCaptions = await server.captions.listVideoCaptions({ videoId: idHttp }) 62 const bodyCaptions = await server.captions.list({ videoId: idHttp })
63 expect(bodyCaptions.total).to.equal(2) 63 expect(bodyCaptions.total).to.equal(2)
64 } 64 }
65 65
@@ -76,7 +76,7 @@ describe('Test video imports', function () {
76 76
77 expect(video.files).to.have.lengthOf(1) 77 expect(video.files).to.have.lengthOf(1)
78 78
79 const bodyCaptions = await server.captions.listVideoCaptions({ videoId: id }) 79 const bodyCaptions = await server.captions.list({ videoId: id })
80 expect(bodyCaptions.total).to.equal(2) 80 expect(bodyCaptions.total).to.equal(2)
81 } 81 }
82 82
@@ -120,7 +120,7 @@ describe('Test video imports', function () {
120 await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath) 120 await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath)
121 await testImage(servers[0].url, 'video_import_preview', video.previewPath) 121 await testImage(servers[0].url, 'video_import_preview', video.previewPath)
122 122
123 const bodyCaptions = await servers[0].captions.listVideoCaptions({ videoId: video.id }) 123 const bodyCaptions = await servers[0].captions.list({ videoId: video.id })
124 const videoCaptions = bodyCaptions.data 124 const videoCaptions = bodyCaptions.data
125 expect(videoCaptions).to.have.lengthOf(2) 125 expect(videoCaptions).to.have.lengthOf(2)
126 126
diff --git a/shared/extra-utils/videos/captions-command.ts b/shared/extra-utils/videos/captions-command.ts
index a0608e1a6..a65ea99e3 100644
--- a/shared/extra-utils/videos/captions-command.ts
+++ b/shared/extra-utils/videos/captions-command.ts
@@ -4,7 +4,7 @@ import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 4
5export class CaptionsCommand extends AbstractCommand { 5export class CaptionsCommand extends AbstractCommand {
6 6
7 createVideoCaption (options: OverrideCommandOptions & { 7 add (options: OverrideCommandOptions & {
8 videoId: string | number 8 videoId: string | number
9 language: string 9 language: string
10 fixture: string 10 fixture: string
@@ -32,7 +32,7 @@ export class CaptionsCommand extends AbstractCommand {
32 }) 32 })
33 } 33 }
34 34
35 listVideoCaptions (options: OverrideCommandOptions & { 35 list (options: OverrideCommandOptions & {
36 videoId: string | number 36 videoId: string | number
37 }) { 37 }) {
38 const { videoId } = options 38 const { videoId } = options
@@ -47,7 +47,7 @@ export class CaptionsCommand extends AbstractCommand {
47 }) 47 })
48 } 48 }
49 49
50 deleteVideoCaption (options: OverrideCommandOptions & { 50 delete (options: OverrideCommandOptions & {
51 videoId: string | number 51 videoId: string | number
52 language: string 52 language: string
53 }) { 53 }) {
diff --git a/shared/extra-utils/videos/comments-command.ts b/shared/extra-utils/videos/comments-command.ts
index 5034c57ad..f0d163a07 100644
--- a/shared/extra-utils/videos/comments-command.ts
+++ b/shared/extra-utils/videos/comments-command.ts
@@ -84,7 +84,7 @@ export class CommentsCommand extends AbstractCommand {
84 defaultExpectedStatus: HttpStatusCode.OK_200 84 defaultExpectedStatus: HttpStatusCode.OK_200
85 })) 85 }))
86 86
87 this.lastThreadId = body.comment.id 87 this.lastThreadId = body.comment?.id
88 this.lastVideoId = videoId 88 this.lastVideoId = videoId
89 89
90 return body.comment 90 return body.comment
@@ -107,7 +107,7 @@ export class CommentsCommand extends AbstractCommand {
107 defaultExpectedStatus: HttpStatusCode.OK_200 107 defaultExpectedStatus: HttpStatusCode.OK_200
108 })) 108 }))
109 109
110 this.lastReplyId = body.comment.id 110 this.lastReplyId = body.comment?.id
111 111
112 return body.comment 112 return body.comment
113 } 113 }