aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/live
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/api/live')
-rw-r--r--server/tests/api/live/live-constraints.ts24
-rw-r--r--server/tests/api/live/live-permanent.ts32
-rw-r--r--server/tests/api/live/live-save-replay.ts52
-rw-r--r--server/tests/api/live/live-socket-messages.ts38
-rw-r--r--server/tests/api/live/live-views.ts20
-rw-r--r--server/tests/api/live/live.ts72
6 files changed, 119 insertions, 119 deletions
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index 7900b1abe..1c380883c 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -32,13 +32,13 @@ describe('Test live constraints', function () {
32 saveReplay 32 saveReplay
33 } 33 }
34 34
35 const { uuid } = await servers[0].liveCommand.create({ token: userAccessToken, fields: liveAttributes }) 35 const { uuid } = await servers[0].live.create({ token: userAccessToken, fields: liveAttributes })
36 return uuid 36 return uuid
37 } 37 }
38 38
39 async function checkSaveReplay (videoId: string, resolutions = [ 720 ]) { 39 async function checkSaveReplay (videoId: string, resolutions = [ 720 ]) {
40 for (const server of servers) { 40 for (const server of servers) {
41 const video = await server.videosCommand.get({ id: videoId }) 41 const video = await server.videos.get({ id: videoId })
42 expect(video.isLive).to.be.false 42 expect(video.isLive).to.be.false
43 expect(video.duration).to.be.greaterThan(0) 43 expect(video.duration).to.be.greaterThan(0)
44 } 44 }
@@ -48,12 +48,12 @@ describe('Test live constraints', function () {
48 48
49 async function waitUntilLivePublishedOnAllServers (videoId: string) { 49 async function waitUntilLivePublishedOnAllServers (videoId: string) {
50 for (const server of servers) { 50 for (const server of servers) {
51 await server.liveCommand.waitUntilPublished({ videoId }) 51 await server.live.waitUntilPublished({ videoId })
52 } 52 }
53 } 53 }
54 54
55 function updateQuota (options: { total: number, daily: number }) { 55 function updateQuota (options: { total: number, daily: number }) {
56 return servers[0].usersCommand.update({ 56 return servers[0].users.update({
57 userId, 57 userId,
58 videoQuota: options.total, 58 videoQuota: options.total,
59 videoQuotaDaily: options.daily 59 videoQuotaDaily: options.daily
@@ -69,7 +69,7 @@ describe('Test live constraints', function () {
69 await setAccessTokensToServers(servers) 69 await setAccessTokensToServers(servers)
70 await setDefaultVideoChannel(servers) 70 await setDefaultVideoChannel(servers)
71 71
72 await servers[0].configCommand.updateCustomSubConfig({ 72 await servers[0].config.updateCustomSubConfig({
73 newConfig: { 73 newConfig: {
74 live: { 74 live: {
75 enabled: true, 75 enabled: true,
@@ -82,7 +82,7 @@ describe('Test live constraints', function () {
82 }) 82 })
83 83
84 { 84 {
85 const res = await servers[0].usersCommand.generate('user1') 85 const res = await servers[0].users.generate('user1')
86 userId = res.userId 86 userId = res.userId
87 userChannelId = res.userChannelId 87 userChannelId = res.userChannelId
88 userAccessToken = res.token 88 userAccessToken = res.token
@@ -98,7 +98,7 @@ describe('Test live constraints', function () {
98 this.timeout(60000) 98 this.timeout(60000)
99 99
100 const userVideoLiveoId = await createLiveWrapper(false) 100 const userVideoLiveoId = await createLiveWrapper(false)
101 await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) 101 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
102 }) 102 })
103 103
104 it('Should have size limit depending on user global quota if save replay is enabled', async function () { 104 it('Should have size limit depending on user global quota if save replay is enabled', async function () {
@@ -108,7 +108,7 @@ describe('Test live constraints', function () {
108 await wait(5000) 108 await wait(5000)
109 109
110 const userVideoLiveoId = await createLiveWrapper(true) 110 const userVideoLiveoId = await createLiveWrapper(true)
111 await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) 111 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
112 112
113 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 113 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
114 await waitJobs(servers) 114 await waitJobs(servers)
@@ -125,7 +125,7 @@ describe('Test live constraints', function () {
125 await updateQuota({ total: -1, daily: 1 }) 125 await updateQuota({ total: -1, daily: 1 })
126 126
127 const userVideoLiveoId = await createLiveWrapper(true) 127 const userVideoLiveoId = await createLiveWrapper(true)
128 await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) 128 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
129 129
130 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 130 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
131 await waitJobs(servers) 131 await waitJobs(servers)
@@ -142,13 +142,13 @@ describe('Test live constraints', function () {
142 await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) 142 await updateQuota({ total: 10 * 1000 * 1000, daily: -1 })
143 143
144 const userVideoLiveoId = await createLiveWrapper(true) 144 const userVideoLiveoId = await createLiveWrapper(true)
145 await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) 145 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
146 }) 146 })
147 147
148 it('Should have max duration limit', async function () { 148 it('Should have max duration limit', async function () {
149 this.timeout(60000) 149 this.timeout(60000)
150 150
151 await servers[0].configCommand.updateCustomSubConfig({ 151 await servers[0].config.updateCustomSubConfig({
152 newConfig: { 152 newConfig: {
153 live: { 153 live: {
154 enabled: true, 154 enabled: true,
@@ -163,7 +163,7 @@ describe('Test live constraints', function () {
163 }) 163 })
164 164
165 const userVideoLiveoId = await createLiveWrapper(true) 165 const userVideoLiveoId = await createLiveWrapper(true)
166 await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) 166 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
167 167
168 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 168 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
169 await waitJobs(servers) 169 await waitJobs(servers)
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 707f2edf8..900bd6f5c 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -24,20 +24,20 @@ describe('Permanent live', function () {
24 24
25 async function createLiveWrapper (permanentLive: boolean) { 25 async function createLiveWrapper (permanentLive: boolean) {
26 const attributes: LiveVideoCreate = { 26 const attributes: LiveVideoCreate = {
27 channelId: servers[0].videoChannel.id, 27 channelId: servers[0].store.channel.id,
28 privacy: VideoPrivacy.PUBLIC, 28 privacy: VideoPrivacy.PUBLIC,
29 name: 'my super live', 29 name: 'my super live',
30 saveReplay: false, 30 saveReplay: false,
31 permanentLive 31 permanentLive
32 } 32 }
33 33
34 const { uuid } = await servers[0].liveCommand.create({ fields: attributes }) 34 const { uuid } = await servers[0].live.create({ fields: attributes })
35 return uuid 35 return uuid
36 } 36 }
37 37
38 async function checkVideoState (videoId: string, state: VideoState) { 38 async function checkVideoState (videoId: string, state: VideoState) {
39 for (const server of servers) { 39 for (const server of servers) {
40 const video = await server.videosCommand.get({ id: videoId }) 40 const video = await server.videos.get({ id: videoId })
41 expect(video.state.id).to.equal(state) 41 expect(video.state.id).to.equal(state)
42 } 42 }
43 } 43 }
@@ -54,7 +54,7 @@ describe('Permanent live', function () {
54 // Server 1 and server 2 follow each other 54 // Server 1 and server 2 follow each other
55 await doubleFollow(servers[0], servers[1]) 55 await doubleFollow(servers[0], servers[1])
56 56
57 await servers[0].configCommand.updateCustomSubConfig({ 57 await servers[0].config.updateCustomSubConfig({
58 newConfig: { 58 newConfig: {
59 live: { 59 live: {
60 enabled: true, 60 enabled: true,
@@ -75,14 +75,14 @@ describe('Permanent live', function () {
75 const videoUUID = await createLiveWrapper(false) 75 const videoUUID = await createLiveWrapper(false)
76 76
77 { 77 {
78 const live = await servers[0].liveCommand.get({ videoId: videoUUID }) 78 const live = await servers[0].live.get({ videoId: videoUUID })
79 expect(live.permanentLive).to.be.false 79 expect(live.permanentLive).to.be.false
80 } 80 }
81 81
82 await servers[0].liveCommand.update({ videoId: videoUUID, fields: { permanentLive: true } }) 82 await servers[0].live.update({ videoId: videoUUID, fields: { permanentLive: true } })
83 83
84 { 84 {
85 const live = await servers[0].liveCommand.get({ videoId: videoUUID }) 85 const live = await servers[0].live.get({ videoId: videoUUID })
86 expect(live.permanentLive).to.be.true 86 expect(live.permanentLive).to.be.true
87 } 87 }
88 }) 88 })
@@ -92,7 +92,7 @@ describe('Permanent live', function () {
92 92
93 videoUUID = await createLiveWrapper(true) 93 videoUUID = await createLiveWrapper(true)
94 94
95 const live = await servers[0].liveCommand.get({ videoId: videoUUID }) 95 const live = await servers[0].live.get({ videoId: videoUUID })
96 expect(live.permanentLive).to.be.true 96 expect(live.permanentLive).to.be.true
97 97
98 await waitJobs(servers) 98 await waitJobs(servers)
@@ -101,16 +101,16 @@ describe('Permanent live', function () {
101 it('Should stream into this permanent live', async function () { 101 it('Should stream into this permanent live', async function () {
102 this.timeout(120000) 102 this.timeout(120000)
103 103
104 const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) 104 const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID })
105 105
106 for (const server of servers) { 106 for (const server of servers) {
107 await server.liveCommand.waitUntilPublished({ videoId: videoUUID }) 107 await server.live.waitUntilPublished({ videoId: videoUUID })
108 } 108 }
109 109
110 await checkVideoState(videoUUID, VideoState.PUBLISHED) 110 await checkVideoState(videoUUID, VideoState.PUBLISHED)
111 111
112 await stopFfmpeg(ffmpegCommand) 112 await stopFfmpeg(ffmpegCommand)
113 await servers[0].liveCommand.waitUntilWaiting({ videoId: videoUUID }) 113 await servers[0].live.waitUntilWaiting({ videoId: videoUUID })
114 114
115 await waitJobs(servers) 115 await waitJobs(servers)
116 }) 116 })
@@ -122,7 +122,7 @@ describe('Permanent live', function () {
122 await waitJobs(servers) 122 await waitJobs(servers)
123 123
124 for (const server of servers) { 124 for (const server of servers) {
125 const videoDetails = await server.videosCommand.get({ id: videoUUID }) 125 const videoDetails = await server.videos.get({ id: videoUUID })
126 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) 126 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
127 } 127 }
128 }) 128 })
@@ -136,7 +136,7 @@ describe('Permanent live', function () {
136 it('Should be able to stream again in the permanent live', async function () { 136 it('Should be able to stream again in the permanent live', async function () {
137 this.timeout(20000) 137 this.timeout(20000)
138 138
139 await servers[0].configCommand.updateCustomSubConfig({ 139 await servers[0].config.updateCustomSubConfig({
140 newConfig: { 140 newConfig: {
141 live: { 141 live: {
142 enabled: true, 142 enabled: true,
@@ -150,15 +150,15 @@ describe('Permanent live', function () {
150 } 150 }
151 }) 151 })
152 152
153 const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) 153 const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID })
154 154
155 for (const server of servers) { 155 for (const server of servers) {
156 await server.liveCommand.waitUntilPublished({ videoId: videoUUID }) 156 await server.live.waitUntilPublished({ videoId: videoUUID })
157 } 157 }
158 158
159 await checkVideoState(videoUUID, VideoState.PUBLISHED) 159 await checkVideoState(videoUUID, VideoState.PUBLISHED)
160 160
161 const count = await servers[0].liveCommand.countPlaylists({ videoUUID }) 161 const count = await servers[0].live.countPlaylists({ videoUUID })
162 // master playlist and 720p playlist 162 // master playlist and 720p playlist
163 expect(count).to.equal(2) 163 expect(count).to.equal(2)
164 164
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index a87a2cd12..7a33df90a 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -30,19 +30,19 @@ describe('Save replay setting', function () {
30 async function createLiveWrapper (saveReplay: boolean) { 30 async function createLiveWrapper (saveReplay: boolean) {
31 if (liveVideoUUID) { 31 if (liveVideoUUID) {
32 try { 32 try {
33 await servers[0].videosCommand.remove({ id: liveVideoUUID }) 33 await servers[0].videos.remove({ id: liveVideoUUID })
34 await waitJobs(servers) 34 await waitJobs(servers)
35 } catch {} 35 } catch {}
36 } 36 }
37 37
38 const attributes: LiveVideoCreate = { 38 const attributes: LiveVideoCreate = {
39 channelId: servers[0].videoChannel.id, 39 channelId: servers[0].store.channel.id,
40 privacy: VideoPrivacy.PUBLIC, 40 privacy: VideoPrivacy.PUBLIC,
41 name: 'my super live', 41 name: 'my super live',
42 saveReplay 42 saveReplay
43 } 43 }
44 44
45 const { uuid } = await servers[0].liveCommand.create({ fields: attributes }) 45 const { uuid } = await servers[0].live.create({ fields: attributes })
46 return uuid 46 return uuid
47 } 47 }
48 48
@@ -50,32 +50,32 @@ describe('Save replay setting', function () {
50 for (const server of servers) { 50 for (const server of servers) {
51 const length = existsInList ? 1 : 0 51 const length = existsInList ? 1 : 0
52 52
53 const { data, total } = await server.videosCommand.list() 53 const { data, total } = await server.videos.list()
54 expect(data).to.have.lengthOf(length) 54 expect(data).to.have.lengthOf(length)
55 expect(total).to.equal(length) 55 expect(total).to.equal(length)
56 56
57 if (expectedStatus) { 57 if (expectedStatus) {
58 await server.videosCommand.get({ id: videoId, expectedStatus }) 58 await server.videos.get({ id: videoId, expectedStatus })
59 } 59 }
60 } 60 }
61 } 61 }
62 62
63 async function checkVideoState (videoId: string, state: VideoState) { 63 async function checkVideoState (videoId: string, state: VideoState) {
64 for (const server of servers) { 64 for (const server of servers) {
65 const video = await server.videosCommand.get({ id: videoId }) 65 const video = await server.videos.get({ id: videoId })
66 expect(video.state.id).to.equal(state) 66 expect(video.state.id).to.equal(state)
67 } 67 }
68 } 68 }
69 69
70 async function waitUntilLivePublishedOnAllServers (videoId: string) { 70 async function waitUntilLivePublishedOnAllServers (videoId: string) {
71 for (const server of servers) { 71 for (const server of servers) {
72 await server.liveCommand.waitUntilPublished({ videoId }) 72 await server.live.waitUntilPublished({ videoId })
73 } 73 }
74 } 74 }
75 75
76 async function waitUntilLiveSavedOnAllServers (videoId: string) { 76 async function waitUntilLiveSavedOnAllServers (videoId: string) {
77 for (const server of servers) { 77 for (const server of servers) {
78 await server.liveCommand.waitUntilSaved({ videoId }) 78 await server.live.waitUntilSaved({ videoId })
79 } 79 }
80 } 80 }
81 81
@@ -91,7 +91,7 @@ describe('Save replay setting', function () {
91 // Server 1 and server 2 follow each other 91 // Server 1 and server 2 follow each other
92 await doubleFollow(servers[0], servers[1]) 92 await doubleFollow(servers[0], servers[1])
93 93
94 await servers[0].configCommand.updateCustomSubConfig({ 94 await servers[0].config.updateCustomSubConfig({
95 newConfig: { 95 newConfig: {
96 live: { 96 live: {
97 enabled: true, 97 enabled: true,
@@ -126,7 +126,7 @@ describe('Save replay setting', function () {
126 it('Should correctly have updated the live and federated it when streaming in the live', async function () { 126 it('Should correctly have updated the live and federated it when streaming in the live', async function () {
127 this.timeout(30000) 127 this.timeout(30000)
128 128
129 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 129 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
130 130
131 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 131 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
132 132
@@ -142,7 +142,7 @@ describe('Save replay setting', function () {
142 await stopFfmpeg(ffmpegCommand) 142 await stopFfmpeg(ffmpegCommand)
143 143
144 for (const server of servers) { 144 for (const server of servers) {
145 await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID }) 145 await server.live.waitUntilEnded({ videoId: liveVideoUUID })
146 } 146 }
147 await waitJobs(servers) 147 await waitJobs(servers)
148 148
@@ -159,7 +159,7 @@ describe('Save replay setting', function () {
159 159
160 liveVideoUUID = await createLiveWrapper(false) 160 liveVideoUUID = await createLiveWrapper(false)
161 161
162 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 162 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
163 163
164 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 164 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
165 165
@@ -167,7 +167,7 @@ describe('Save replay setting', function () {
167 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 167 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
168 168
169 await Promise.all([ 169 await Promise.all([
170 servers[0].blacklistCommand.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }), 170 servers[0].blacklist.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }),
171 testFfmpegStreamError(ffmpegCommand, true) 171 testFfmpegStreamError(ffmpegCommand, true)
172 ]) 172 ])
173 173
@@ -175,8 +175,8 @@ describe('Save replay setting', function () {
175 175
176 await checkVideosExist(liveVideoUUID, false) 176 await checkVideosExist(liveVideoUUID, false)
177 177
178 await servers[0].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 178 await servers[0].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
179 await servers[1].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 179 await servers[1].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
180 180
181 await wait(5000) 181 await wait(5000)
182 await waitJobs(servers) 182 await waitJobs(servers)
@@ -188,7 +188,7 @@ describe('Save replay setting', function () {
188 188
189 liveVideoUUID = await createLiveWrapper(false) 189 liveVideoUUID = await createLiveWrapper(false)
190 190
191 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 191 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
192 192
193 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 193 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
194 194
@@ -197,7 +197,7 @@ describe('Save replay setting', function () {
197 197
198 await Promise.all([ 198 await Promise.all([
199 testFfmpegStreamError(ffmpegCommand, true), 199 testFfmpegStreamError(ffmpegCommand, true),
200 servers[0].videosCommand.remove({ id: liveVideoUUID }) 200 servers[0].videos.remove({ id: liveVideoUUID })
201 ]) 201 ])
202 202
203 await wait(5000) 203 await wait(5000)
@@ -224,7 +224,7 @@ describe('Save replay setting', function () {
224 it('Should correctly have updated the live and federated it when streaming in the live', async function () { 224 it('Should correctly have updated the live and federated it when streaming in the live', async function () {
225 this.timeout(20000) 225 this.timeout(20000)
226 226
227 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 227 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
228 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 228 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
229 229
230 await waitJobs(servers) 230 await waitJobs(servers)
@@ -249,11 +249,11 @@ describe('Save replay setting', function () {
249 it('Should update the saved live and correctly federate the updated attributes', async function () { 249 it('Should update the saved live and correctly federate the updated attributes', async function () {
250 this.timeout(30000) 250 this.timeout(30000)
251 251
252 await servers[0].videosCommand.update({ id: liveVideoUUID, attributes: { name: 'video updated' } }) 252 await servers[0].videos.update({ id: liveVideoUUID, attributes: { name: 'video updated' } })
253 await waitJobs(servers) 253 await waitJobs(servers)
254 254
255 for (const server of servers) { 255 for (const server of servers) {
256 const video = await server.videosCommand.get({ id: liveVideoUUID }) 256 const video = await server.videos.get({ id: liveVideoUUID })
257 expect(video.name).to.equal('video updated') 257 expect(video.name).to.equal('video updated')
258 expect(video.isLive).to.be.false 258 expect(video.isLive).to.be.false
259 } 259 }
@@ -268,14 +268,14 @@ describe('Save replay setting', function () {
268 268
269 liveVideoUUID = await createLiveWrapper(true) 269 liveVideoUUID = await createLiveWrapper(true)
270 270
271 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 271 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
272 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 272 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
273 273
274 await waitJobs(servers) 274 await waitJobs(servers)
275 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 275 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
276 276
277 await Promise.all([ 277 await Promise.all([
278 servers[0].blacklistCommand.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }), 278 servers[0].blacklist.add({ videoId: liveVideoUUID, reason: 'bad live', unfederate: true }),
279 testFfmpegStreamError(ffmpegCommand, true) 279 testFfmpegStreamError(ffmpegCommand, true)
280 ]) 280 ])
281 281
@@ -283,8 +283,8 @@ describe('Save replay setting', function () {
283 283
284 await checkVideosExist(liveVideoUUID, false) 284 await checkVideosExist(liveVideoUUID, false)
285 285
286 await servers[0].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 286 await servers[0].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
287 await servers[1].videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 287 await servers[1].videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
288 288
289 await wait(5000) 289 await wait(5000)
290 await waitJobs(servers) 290 await waitJobs(servers)
@@ -296,14 +296,14 @@ describe('Save replay setting', function () {
296 296
297 liveVideoUUID = await createLiveWrapper(true) 297 liveVideoUUID = await createLiveWrapper(true)
298 298
299 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 299 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
300 await waitUntilLivePublishedOnAllServers(liveVideoUUID) 300 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
301 301
302 await waitJobs(servers) 302 await waitJobs(servers)
303 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 303 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
304 304
305 await Promise.all([ 305 await Promise.all([
306 servers[0].videosCommand.remove({ id: liveVideoUUID }), 306 servers[0].videos.remove({ id: liveVideoUUID }),
307 testFfmpegStreamError(ffmpegCommand, true) 307 testFfmpegStreamError(ffmpegCommand, true)
308 ]) 308 ])
309 309
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts
index 1f3d455a8..ad67d6285 100644
--- a/server/tests/api/live/live-socket-messages.ts
+++ b/server/tests/api/live/live-socket-messages.ts
@@ -30,7 +30,7 @@ describe('Test live', function () {
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
31 await setDefaultVideoChannel(servers) 31 await setDefaultVideoChannel(servers)
32 32
33 await servers[0].configCommand.updateCustomSubConfig({ 33 await servers[0].config.updateCustomSubConfig({
34 newConfig: { 34 newConfig: {
35 live: { 35 live: {
36 enabled: true, 36 enabled: true,
@@ -51,11 +51,11 @@ describe('Test live', function () {
51 async function createLiveWrapper () { 51 async function createLiveWrapper () {
52 const liveAttributes = { 52 const liveAttributes = {
53 name: 'live video', 53 name: 'live video',
54 channelId: servers[0].videoChannel.id, 54 channelId: servers[0].store.channel.id,
55 privacy: VideoPrivacy.PUBLIC 55 privacy: VideoPrivacy.PUBLIC
56 } 56 }
57 57
58 const { uuid } = await servers[0].liveCommand.create({ fields: liveAttributes }) 58 const { uuid } = await servers[0].live.create({ fields: liveAttributes })
59 return uuid 59 return uuid
60 } 60 }
61 61
@@ -69,22 +69,22 @@ describe('Test live', function () {
69 await waitJobs(servers) 69 await waitJobs(servers)
70 70
71 { 71 {
72 const videoId = await servers[0].videosCommand.getId({ uuid: liveVideoUUID }) 72 const videoId = await servers[0].videos.getId({ uuid: liveVideoUUID })
73 73
74 const localSocket = servers[0].socketIOCommand.getLiveNotificationSocket() 74 const localSocket = servers[0].socketIO.getLiveNotificationSocket()
75 localSocket.on('state-change', data => localStateChanges.push(data.state)) 75 localSocket.on('state-change', data => localStateChanges.push(data.state))
76 localSocket.emit('subscribe', { videoId }) 76 localSocket.emit('subscribe', { videoId })
77 } 77 }
78 78
79 { 79 {
80 const videoId = await servers[1].videosCommand.getId({ uuid: liveVideoUUID }) 80 const videoId = await servers[1].videos.getId({ uuid: liveVideoUUID })
81 81
82 const remoteSocket = servers[1].socketIOCommand.getLiveNotificationSocket() 82 const remoteSocket = servers[1].socketIO.getLiveNotificationSocket()
83 remoteSocket.on('state-change', data => remoteStateChanges.push(data.state)) 83 remoteSocket.on('state-change', data => remoteStateChanges.push(data.state))
84 remoteSocket.emit('subscribe', { videoId }) 84 remoteSocket.emit('subscribe', { videoId })
85 } 85 }
86 86
87 const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 87 const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
88 88
89 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) 89 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
90 await waitJobs(servers) 90 await waitJobs(servers)
@@ -97,7 +97,7 @@ describe('Test live', function () {
97 await stopFfmpeg(ffmpegCommand) 97 await stopFfmpeg(ffmpegCommand)
98 98
99 for (const server of servers) { 99 for (const server of servers) {
100 await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID }) 100 await server.live.waitUntilEnded({ videoId: liveVideoUUID })
101 } 101 }
102 await waitJobs(servers) 102 await waitJobs(servers)
103 103
@@ -117,22 +117,22 @@ describe('Test live', function () {
117 await waitJobs(servers) 117 await waitJobs(servers)
118 118
119 { 119 {
120 const videoId = await servers[0].videosCommand.getId({ uuid: liveVideoUUID }) 120 const videoId = await servers[0].videos.getId({ uuid: liveVideoUUID })
121 121
122 const localSocket = servers[0].socketIOCommand.getLiveNotificationSocket() 122 const localSocket = servers[0].socketIO.getLiveNotificationSocket()
123 localSocket.on('views-change', data => { localLastVideoViews = data.views }) 123 localSocket.on('views-change', data => { localLastVideoViews = data.views })
124 localSocket.emit('subscribe', { videoId }) 124 localSocket.emit('subscribe', { videoId })
125 } 125 }
126 126
127 { 127 {
128 const videoId = await servers[1].videosCommand.getId({ uuid: liveVideoUUID }) 128 const videoId = await servers[1].videos.getId({ uuid: liveVideoUUID })
129 129
130 const remoteSocket = servers[1].socketIOCommand.getLiveNotificationSocket() 130 const remoteSocket = servers[1].socketIO.getLiveNotificationSocket()
131 remoteSocket.on('views-change', data => { remoteLastVideoViews = data.views }) 131 remoteSocket.on('views-change', data => { remoteLastVideoViews = data.views })
132 remoteSocket.emit('subscribe', { videoId }) 132 remoteSocket.emit('subscribe', { videoId })
133 } 133 }
134 134
135 const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 135 const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
136 136
137 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) 137 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
138 await waitJobs(servers) 138 await waitJobs(servers)
@@ -140,8 +140,8 @@ describe('Test live', function () {
140 expect(localLastVideoViews).to.equal(0) 140 expect(localLastVideoViews).to.equal(0)
141 expect(remoteLastVideoViews).to.equal(0) 141 expect(remoteLastVideoViews).to.equal(0)
142 142
143 await servers[0].videosCommand.view({ id: liveVideoUUID }) 143 await servers[0].videos.view({ id: liveVideoUUID })
144 await servers[1].videosCommand.view({ id: liveVideoUUID }) 144 await servers[1].videos.view({ id: liveVideoUUID })
145 145
146 await waitJobs(servers) 146 await waitJobs(servers)
147 await wait(5000) 147 await wait(5000)
@@ -161,13 +161,13 @@ describe('Test live', function () {
161 const liveVideoUUID = await createLiveWrapper() 161 const liveVideoUUID = await createLiveWrapper()
162 await waitJobs(servers) 162 await waitJobs(servers)
163 163
164 const videoId = await servers[0].videosCommand.getId({ uuid: liveVideoUUID }) 164 const videoId = await servers[0].videos.getId({ uuid: liveVideoUUID })
165 165
166 const socket = servers[0].socketIOCommand.getLiveNotificationSocket() 166 const socket = servers[0].socketIO.getLiveNotificationSocket()
167 socket.on('state-change', data => stateChanges.push(data.state)) 167 socket.on('state-change', data => stateChanges.push(data.state))
168 socket.emit('subscribe', { videoId }) 168 socket.emit('subscribe', { videoId })
169 169
170 const command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 170 const command = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
171 171
172 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) 172 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
173 await waitJobs(servers) 173 await waitJobs(servers)
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts
index 1951b11a5..43222f9c9 100644
--- a/server/tests/api/live/live-views.ts
+++ b/server/tests/api/live/live-views.ts
@@ -31,7 +31,7 @@ describe('Test live', function () {
31 await setAccessTokensToServers(servers) 31 await setAccessTokensToServers(servers)
32 await setDefaultVideoChannel(servers) 32 await setDefaultVideoChannel(servers)
33 33
34 await servers[0].configCommand.updateCustomSubConfig({ 34 await servers[0].config.updateCustomSubConfig({
35 newConfig: { 35 newConfig: {
36 live: { 36 live: {
37 enabled: true, 37 enabled: true,
@@ -53,7 +53,7 @@ describe('Test live', function () {
53 53
54 async function countViews (expected: number) { 54 async function countViews (expected: number) {
55 for (const server of servers) { 55 for (const server of servers) {
56 const video = await server.videosCommand.get({ id: liveVideoId }) 56 const video = await server.videos.get({ id: liveVideoId })
57 expect(video.views).to.equal(expected) 57 expect(video.views).to.equal(expected)
58 } 58 }
59 } 59 }
@@ -63,14 +63,14 @@ describe('Test live', function () {
63 63
64 const liveAttributes = { 64 const liveAttributes = {
65 name: 'live video', 65 name: 'live video',
66 channelId: servers[0].videoChannel.id, 66 channelId: servers[0].store.channel.id,
67 privacy: VideoPrivacy.PUBLIC 67 privacy: VideoPrivacy.PUBLIC
68 } 68 }
69 69
70 const live = await servers[0].liveCommand.create({ fields: liveAttributes }) 70 const live = await servers[0].live.create({ fields: liveAttributes })
71 liveVideoId = live.uuid 71 liveVideoId = live.uuid
72 72
73 command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) 73 command = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoId })
74 await waitUntilLivePublishedOnAllServers(servers, liveVideoId) 74 await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
75 await waitJobs(servers) 75 await waitJobs(servers)
76 }) 76 })
@@ -82,8 +82,8 @@ describe('Test live', function () {
82 it('Should view a live twice and display 1 view', async function () { 82 it('Should view a live twice and display 1 view', async function () {
83 this.timeout(30000) 83 this.timeout(30000)
84 84
85 await servers[0].videosCommand.view({ id: liveVideoId }) 85 await servers[0].videos.view({ id: liveVideoId })
86 await servers[0].videosCommand.view({ id: liveVideoId }) 86 await servers[0].videos.view({ id: liveVideoId })
87 87
88 await wait(7000) 88 await wait(7000)
89 89
@@ -104,9 +104,9 @@ describe('Test live', function () {
104 it('Should view a live on a remote and on local and display 2 views', async function () { 104 it('Should view a live on a remote and on local and display 2 views', async function () {
105 this.timeout(30000) 105 this.timeout(30000)
106 106
107 await servers[0].videosCommand.view({ id: liveVideoId }) 107 await servers[0].videos.view({ id: liveVideoId })
108 await servers[1].videosCommand.view({ id: liveVideoId }) 108 await servers[1].videos.view({ id: liveVideoId })
109 await servers[1].videosCommand.view({ id: liveVideoId }) 109 await servers[1].videos.view({ id: liveVideoId })
110 110
111 await wait(7000) 111 await wait(7000)
112 await waitJobs(servers) 112 await waitJobs(servers)
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index c88143982..2cce1f448 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -44,7 +44,7 @@ describe('Test live', function () {
44 await setAccessTokensToServers(servers) 44 await setAccessTokensToServers(servers)
45 await setDefaultVideoChannel(servers) 45 await setDefaultVideoChannel(servers)
46 46
47 await servers[0].configCommand.updateCustomSubConfig({ 47 await servers[0].config.updateCustomSubConfig({
48 newConfig: { 48 newConfig: {
49 live: { 49 live: {
50 enabled: true, 50 enabled: true,
@@ -59,7 +59,7 @@ describe('Test live', function () {
59 // Server 1 and server 2 follow each other 59 // Server 1 and server 2 follow each other
60 await doubleFollow(servers[0], servers[1]) 60 await doubleFollow(servers[0], servers[1])
61 61
62 commands = servers.map(s => s.liveCommand) 62 commands = servers.map(s => s.live)
63 }) 63 })
64 64
65 describe('Live creation, update and delete', function () { 65 describe('Live creation, update and delete', function () {
@@ -74,7 +74,7 @@ describe('Test live', function () {
74 language: 'fr', 74 language: 'fr',
75 description: 'super live description', 75 description: 'super live description',
76 support: 'support field', 76 support: 'support field',
77 channelId: servers[0].videoChannel.id, 77 channelId: servers[0].store.channel.id,
78 nsfw: false, 78 nsfw: false,
79 waitTranscoding: false, 79 waitTranscoding: false,
80 name: 'my super live', 80 name: 'my super live',
@@ -93,7 +93,7 @@ describe('Test live', function () {
93 await waitJobs(servers) 93 await waitJobs(servers)
94 94
95 for (const server of servers) { 95 for (const server of servers) {
96 const video = await server.videosCommand.get({ id: liveVideoUUID }) 96 const video = await server.videos.get({ id: liveVideoUUID })
97 97
98 expect(video.category.id).to.equal(1) 98 expect(video.category.id).to.equal(1)
99 expect(video.licence.id).to.equal(2) 99 expect(video.licence.id).to.equal(2)
@@ -101,8 +101,8 @@ describe('Test live', function () {
101 expect(video.description).to.equal('super live description') 101 expect(video.description).to.equal('super live description')
102 expect(video.support).to.equal('support field') 102 expect(video.support).to.equal('support field')
103 103
104 expect(video.channel.name).to.equal(servers[0].videoChannel.name) 104 expect(video.channel.name).to.equal(servers[0].store.channel.name)
105 expect(video.channel.host).to.equal(servers[0].videoChannel.host) 105 expect(video.channel.host).to.equal(servers[0].store.channel.host)
106 106
107 expect(video.isLive).to.be.true 107 expect(video.isLive).to.be.true
108 108
@@ -117,7 +117,7 @@ describe('Test live', function () {
117 await testImage(server.url, 'video_short1-preview.webm', video.previewPath) 117 await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
118 await testImage(server.url, 'video_short1.webm', video.thumbnailPath) 118 await testImage(server.url, 'video_short1.webm', video.thumbnailPath)
119 119
120 const live = await server.liveCommand.get({ videoId: liveVideoUUID }) 120 const live = await server.live.get({ videoId: liveVideoUUID })
121 121
122 if (server.url === servers[0].url) { 122 if (server.url === servers[0].url) {
123 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') 123 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
@@ -136,7 +136,7 @@ describe('Test live', function () {
136 136
137 const attributes: LiveVideoCreate = { 137 const attributes: LiveVideoCreate = {
138 name: 'default live thumbnail', 138 name: 'default live thumbnail',
139 channelId: servers[0].videoChannel.id, 139 channelId: servers[0].store.channel.id,
140 privacy: VideoPrivacy.UNLISTED, 140 privacy: VideoPrivacy.UNLISTED,
141 nsfw: true 141 nsfw: true
142 } 142 }
@@ -147,7 +147,7 @@ describe('Test live', function () {
147 await waitJobs(servers) 147 await waitJobs(servers)
148 148
149 for (const server of servers) { 149 for (const server of servers) {
150 const video = await server.videosCommand.get({ id: videoId }) 150 const video = await server.videos.get({ id: videoId })
151 expect(video.privacy.id).to.equal(VideoPrivacy.UNLISTED) 151 expect(video.privacy.id).to.equal(VideoPrivacy.UNLISTED)
152 expect(video.nsfw).to.be.true 152 expect(video.nsfw).to.be.true
153 153
@@ -158,7 +158,7 @@ describe('Test live', function () {
158 158
159 it('Should not have the live listed since nobody streams into', async function () { 159 it('Should not have the live listed since nobody streams into', async function () {
160 for (const server of servers) { 160 for (const server of servers) {
161 const { total, data } = await server.videosCommand.list() 161 const { total, data } = await server.videos.list()
162 162
163 expect(total).to.equal(0) 163 expect(total).to.equal(0)
164 expect(data).to.have.lengthOf(0) 164 expect(data).to.have.lengthOf(0)
@@ -178,7 +178,7 @@ describe('Test live', function () {
178 178
179 it('Have the live updated', async function () { 179 it('Have the live updated', async function () {
180 for (const server of servers) { 180 for (const server of servers) {
181 const live = await server.liveCommand.get({ videoId: liveVideoUUID }) 181 const live = await server.live.get({ videoId: liveVideoUUID })
182 182
183 if (server.url === servers[0].url) { 183 if (server.url === servers[0].url) {
184 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') 184 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
@@ -195,14 +195,14 @@ describe('Test live', function () {
195 it('Delete the live', async function () { 195 it('Delete the live', async function () {
196 this.timeout(10000) 196 this.timeout(10000)
197 197
198 await servers[0].videosCommand.remove({ id: liveVideoUUID }) 198 await servers[0].videos.remove({ id: liveVideoUUID })
199 await waitJobs(servers) 199 await waitJobs(servers)
200 }) 200 })
201 201
202 it('Should have the live deleted', async function () { 202 it('Should have the live deleted', async function () {
203 for (const server of servers) { 203 for (const server of servers) {
204 await server.videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 204 await server.videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
205 await server.liveCommand.get({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 205 await server.live.get({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
206 } 206 }
207 }) 207 })
208 }) 208 })
@@ -215,19 +215,19 @@ describe('Test live', function () {
215 before(async function () { 215 before(async function () {
216 this.timeout(120000) 216 this.timeout(120000)
217 217
218 vodVideoId = (await servers[0].videosCommand.quickUpload({ name: 'vod video' })).uuid 218 vodVideoId = (await servers[0].videos.quickUpload({ name: 'vod video' })).uuid
219 219
220 const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id } 220 const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].store.channel.id }
221 const live = await commands[0].create({ fields: liveOptions }) 221 const live = await commands[0].create({ fields: liveOptions })
222 liveVideoId = live.uuid 222 liveVideoId = live.uuid
223 223
224 ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) 224 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoId })
225 await waitUntilLivePublishedOnAllServers(servers, liveVideoId) 225 await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
226 await waitJobs(servers) 226 await waitJobs(servers)
227 }) 227 })
228 228
229 it('Should only display lives', async function () { 229 it('Should only display lives', async function () {
230 const { data, total } = await servers[0].videosCommand.list({ isLive: true }) 230 const { data, total } = await servers[0].videos.list({ isLive: true })
231 231
232 expect(total).to.equal(1) 232 expect(total).to.equal(1)
233 expect(data).to.have.lengthOf(1) 233 expect(data).to.have.lengthOf(1)
@@ -235,7 +235,7 @@ describe('Test live', function () {
235 }) 235 })
236 236
237 it('Should not display lives', async function () { 237 it('Should not display lives', async function () {
238 const { data, total } = await servers[0].videosCommand.list({ isLive: false }) 238 const { data, total } = await servers[0].videos.list({ isLive: false })
239 239
240 expect(total).to.equal(1) 240 expect(total).to.equal(1)
241 expect(data).to.have.lengthOf(1) 241 expect(data).to.have.lengthOf(1)
@@ -248,22 +248,22 @@ describe('Test live', function () {
248 await stopFfmpeg(ffmpegCommand) 248 await stopFfmpeg(ffmpegCommand)
249 await waitJobs(servers) 249 await waitJobs(servers)
250 250
251 const { data } = await servers[0].videosCommand.listMyVideos({ isLive: true }) 251 const { data } = await servers[0].videos.listMyVideos({ isLive: true })
252 252
253 const result = data.every(v => v.isLive) 253 const result = data.every(v => v.isLive)
254 expect(result).to.be.true 254 expect(result).to.be.true
255 }) 255 })
256 256
257 it('Should not display my lives', async function () { 257 it('Should not display my lives', async function () {
258 const { data } = await servers[0].videosCommand.listMyVideos({ isLive: false }) 258 const { data } = await servers[0].videos.listMyVideos({ isLive: false })
259 259
260 const result = data.every(v => !v.isLive) 260 const result = data.every(v => !v.isLive)
261 expect(result).to.be.true 261 expect(result).to.be.true
262 }) 262 })
263 263
264 after(async function () { 264 after(async function () {
265 await servers[0].videosCommand.remove({ id: vodVideoId }) 265 await servers[0].videos.remove({ id: vodVideoId })
266 await servers[0].videosCommand.remove({ id: liveVideoId }) 266 await servers[0].videos.remove({ id: liveVideoId })
267 }) 267 })
268 }) 268 })
269 269
@@ -278,7 +278,7 @@ describe('Test live', function () {
278 async function createLiveWrapper () { 278 async function createLiveWrapper () {
279 const liveAttributes = { 279 const liveAttributes = {
280 name: 'user live', 280 name: 'user live',
281 channelId: servers[0].videoChannel.id, 281 channelId: servers[0].store.channel.id,
282 privacy: VideoPrivacy.PUBLIC, 282 privacy: VideoPrivacy.PUBLIC,
283 saveReplay: false 283 saveReplay: false
284 } 284 }
@@ -286,7 +286,7 @@ describe('Test live', function () {
286 const { uuid } = await commands[0].create({ fields: liveAttributes }) 286 const { uuid } = await commands[0].create({ fields: liveAttributes })
287 287
288 const live = await commands[0].get({ videoId: uuid }) 288 const live = await commands[0].get({ videoId: uuid })
289 const video = await servers[0].videosCommand.get({ id: uuid }) 289 const video = await servers[0].videos.get({ id: uuid })
290 290
291 return Object.assign(video, live) 291 return Object.assign(video, live)
292 } 292 }
@@ -316,7 +316,7 @@ describe('Test live', function () {
316 316
317 it('Should list this live now someone stream into it', async function () { 317 it('Should list this live now someone stream into it', async function () {
318 for (const server of servers) { 318 for (const server of servers) {
319 const { total, data } = await server.videosCommand.list() 319 const { total, data } = await server.videos.list()
320 320
321 expect(total).to.equal(1) 321 expect(total).to.equal(1)
322 expect(data).to.have.lengthOf(1) 322 expect(data).to.have.lengthOf(1)
@@ -332,7 +332,7 @@ describe('Test live', function () {
332 332
333 liveVideo = await createLiveWrapper() 333 liveVideo = await createLiveWrapper()
334 334
335 await servers[0].blacklistCommand.add({ videoId: liveVideo.uuid }) 335 await servers[0].blacklist.add({ videoId: liveVideo.uuid })
336 336
337 const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey) 337 const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey)
338 await testFfmpegStreamError(command, true) 338 await testFfmpegStreamError(command, true)
@@ -343,7 +343,7 @@ describe('Test live', function () {
343 343
344 liveVideo = await createLiveWrapper() 344 liveVideo = await createLiveWrapper()
345 345
346 await servers[0].videosCommand.remove({ id: liveVideo.uuid }) 346 await servers[0].videos.remove({ id: liveVideo.uuid })
347 347
348 const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey) 348 const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey)
349 await testFfmpegStreamError(command, true) 349 await testFfmpegStreamError(command, true)
@@ -356,7 +356,7 @@ describe('Test live', function () {
356 async function createLiveWrapper (saveReplay: boolean) { 356 async function createLiveWrapper (saveReplay: boolean) {
357 const liveAttributes = { 357 const liveAttributes = {
358 name: 'live video', 358 name: 'live video',
359 channelId: servers[0].videoChannel.id, 359 channelId: servers[0].store.channel.id,
360 privacy: VideoPrivacy.PUBLIC, 360 privacy: VideoPrivacy.PUBLIC,
361 saveReplay 361 saveReplay
362 } 362 }
@@ -367,10 +367,10 @@ describe('Test live', function () {
367 367
368 async function testVideoResolutions (liveVideoId: string, resolutions: number[]) { 368 async function testVideoResolutions (liveVideoId: string, resolutions: number[]) {
369 for (const server of servers) { 369 for (const server of servers) {
370 const { data } = await server.videosCommand.list() 370 const { data } = await server.videos.list()
371 expect(data.find(v => v.uuid === liveVideoId)).to.exist 371 expect(data.find(v => v.uuid === liveVideoId)).to.exist
372 372
373 const video = await server.videosCommand.get({ id: liveVideoId }) 373 const video = await server.videos.get({ id: liveVideoId })
374 374
375 expect(video.streamingPlaylists).to.have.lengthOf(1) 375 expect(video.streamingPlaylists).to.have.lengthOf(1)
376 376
@@ -387,7 +387,7 @@ describe('Test live', function () {
387 const segmentName = `${i}-00000${segmentNum}.ts` 387 const segmentName = `${i}-00000${segmentNum}.ts`
388 await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) 388 await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum })
389 389
390 const subPlaylist = await servers[0].streamingPlaylistsCommand.get({ 390 const subPlaylist = await servers[0].streamingPlaylists.get({
391 url: `${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8` 391 url: `${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`
392 }) 392 })
393 393
@@ -406,7 +406,7 @@ describe('Test live', function () {
406 } 406 }
407 407
408 function updateConf (resolutions: number[]) { 408 function updateConf (resolutions: number[]) {
409 return servers[0].configCommand.updateCustomSubConfig({ 409 return servers[0].config.updateCustomSubConfig({
410 newConfig: { 410 newConfig: {
411 live: { 411 live: {
412 enabled: true, 412 enabled: true,
@@ -490,7 +490,7 @@ describe('Test live', function () {
490 } 490 }
491 491
492 for (const server of servers) { 492 for (const server of servers) {
493 const video = await server.videosCommand.get({ id: liveVideoId }) 493 const video = await server.videos.get({ id: liveVideoId })
494 494
495 expect(video.state.id).to.equal(VideoState.PUBLISHED) 495 expect(video.state.id).to.equal(VideoState.PUBLISHED)
496 expect(video.duration).to.be.greaterThan(1) 496 expect(video.duration).to.be.greaterThan(1)
@@ -515,7 +515,7 @@ describe('Test live', function () {
515 } 515 }
516 516
517 const filename = `${video.uuid}-${resolution}-fragmented.mp4` 517 const filename = `${video.uuid}-${resolution}-fragmented.mp4`
518 const segmentPath = servers[0].serversCommand.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename)) 518 const segmentPath = servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename))
519 519
520 const probe = await ffprobePromise(segmentPath) 520 const probe = await ffprobePromise(segmentPath)
521 const videoStream = await getVideoStreamFromFile(segmentPath, probe) 521 const videoStream = await getVideoStreamFromFile(segmentPath, probe)
@@ -542,7 +542,7 @@ describe('Test live', function () {
542 async function createLiveWrapper (saveReplay: boolean) { 542 async function createLiveWrapper (saveReplay: boolean) {
543 const liveAttributes = { 543 const liveAttributes = {
544 name: 'live video', 544 name: 'live video',
545 channelId: servers[0].videoChannel.id, 545 channelId: servers[0].store.channel.id,
546 privacy: VideoPrivacy.PUBLIC, 546 privacy: VideoPrivacy.PUBLIC,
547 saveReplay 547 saveReplay
548 } 548 }