aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-privacy.ts
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/videos/video-privacy.ts
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/api/videos/video-privacy.ts')
-rw-r--r--server/tests/api/videos/video-privacy.ts56
1 files changed, 28 insertions, 28 deletions
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index bcf431edb..de08a9e7b 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -52,28 +52,28 @@ describe('Test video privacy', function () {
52 52
53 for (const privacy of [ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]) { 53 for (const privacy of [ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]) {
54 const attributes = { privacy } 54 const attributes = { privacy }
55 await servers[0].videosCommand.upload({ attributes }) 55 await servers[0].videos.upload({ attributes })
56 } 56 }
57 57
58 await waitJobs(servers) 58 await waitJobs(servers)
59 }) 59 })
60 60
61 it('Should not have these private and internal videos on server 2', async function () { 61 it('Should not have these private and internal videos on server 2', async function () {
62 const { total, data } = await servers[1].videosCommand.list() 62 const { total, data } = await servers[1].videos.list()
63 63
64 expect(total).to.equal(0) 64 expect(total).to.equal(0)
65 expect(data).to.have.lengthOf(0) 65 expect(data).to.have.lengthOf(0)
66 }) 66 })
67 67
68 it('Should not list the private and internal videos for an unauthenticated user on server 1', async function () { 68 it('Should not list the private and internal videos for an unauthenticated user on server 1', async function () {
69 const { total, data } = await servers[0].videosCommand.list() 69 const { total, data } = await servers[0].videos.list()
70 70
71 expect(total).to.equal(0) 71 expect(total).to.equal(0)
72 expect(data).to.have.lengthOf(0) 72 expect(data).to.have.lengthOf(0)
73 }) 73 })
74 74
75 it('Should not list the private video and list the internal video for an authenticated user on server 1', async function () { 75 it('Should not list the private video and list the internal video for an authenticated user on server 1', async function () {
76 const { total, data } = await servers[0].videosCommand.listWithToken() 76 const { total, data } = await servers[0].videos.listWithToken()
77 77
78 expect(total).to.equal(1) 78 expect(total).to.equal(1)
79 expect(data).to.have.lengthOf(1) 79 expect(data).to.have.lengthOf(1)
@@ -82,7 +82,7 @@ describe('Test video privacy', function () {
82 }) 82 })
83 83
84 it('Should list my (private and internal) videos', async function () { 84 it('Should list my (private and internal) videos', async function () {
85 const { total, data } = await servers[0].videosCommand.listMyVideos() 85 const { total, data } = await servers[0].videos.listMyVideos()
86 86
87 expect(total).to.equal(2) 87 expect(total).to.equal(2)
88 expect(data).to.have.lengthOf(2) 88 expect(data).to.have.lengthOf(2)
@@ -97,8 +97,8 @@ describe('Test video privacy', function () {
97 }) 97 })
98 98
99 it('Should not be able to watch the private/internal video with non authenticated user', async function () { 99 it('Should not be able to watch the private/internal video with non authenticated user', async function () {
100 await servers[0].videosCommand.get({ id: privateVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 100 await servers[0].videos.get({ id: privateVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
101 await servers[0].videosCommand.get({ id: internalVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 101 await servers[0].videos.get({ id: internalVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
102 }) 102 })
103 103
104 it('Should not be able to watch the private video with another user', async function () { 104 it('Should not be able to watch the private video with another user', async function () {
@@ -108,11 +108,11 @@ describe('Test video privacy', function () {
108 username: 'hello', 108 username: 'hello',
109 password: 'super password' 109 password: 'super password'
110 } 110 }
111 await servers[0].usersCommand.create({ username: user.username, password: user.password }) 111 await servers[0].users.create({ username: user.username, password: user.password })
112 112
113 anotherUserToken = await servers[0].loginCommand.getAccessToken(user) 113 anotherUserToken = await servers[0].login.getAccessToken(user)
114 114
115 await servers[0].videosCommand.getWithToken({ 115 await servers[0].videos.getWithToken({
116 token: anotherUserToken, 116 token: anotherUserToken,
117 id: privateVideoUUID, 117 id: privateVideoUUID,
118 expectedStatus: HttpStatusCode.FORBIDDEN_403 118 expectedStatus: HttpStatusCode.FORBIDDEN_403
@@ -120,11 +120,11 @@ describe('Test video privacy', function () {
120 }) 120 })
121 121
122 it('Should be able to watch the internal video with another user', async function () { 122 it('Should be able to watch the internal video with another user', async function () {
123 await servers[0].videosCommand.getWithToken({ token: anotherUserToken, id: internalVideoUUID }) 123 await servers[0].videos.getWithToken({ token: anotherUserToken, id: internalVideoUUID })
124 }) 124 })
125 125
126 it('Should be able to watch the private video with the correct user', async function () { 126 it('Should be able to watch the private video with the correct user', async function () {
127 await servers[0].videosCommand.getWithToken({ id: privateVideoUUID }) 127 await servers[0].videos.getWithToken({ id: privateVideoUUID })
128 }) 128 })
129 }) 129 })
130 130
@@ -137,7 +137,7 @@ describe('Test video privacy', function () {
137 name: 'unlisted video', 137 name: 'unlisted video',
138 privacy: VideoPrivacy.UNLISTED 138 privacy: VideoPrivacy.UNLISTED
139 } 139 }
140 await servers[1].videosCommand.upload({ attributes }) 140 await servers[1].videos.upload({ attributes })
141 141
142 // Server 2 has transcoding enabled 142 // Server 2 has transcoding enabled
143 await waitJobs(servers) 143 await waitJobs(servers)
@@ -145,7 +145,7 @@ describe('Test video privacy', function () {
145 145
146 it('Should not have this unlisted video listed on server 1 and 2', async function () { 146 it('Should not have this unlisted video listed on server 1 and 2', async function () {
147 for (const server of servers) { 147 for (const server of servers) {
148 const { total, data } = await server.videosCommand.list() 148 const { total, data } = await server.videos.list()
149 149
150 expect(total).to.equal(0) 150 expect(total).to.equal(0)
151 expect(data).to.have.lengthOf(0) 151 expect(data).to.have.lengthOf(0)
@@ -153,7 +153,7 @@ describe('Test video privacy', function () {
153 }) 153 })
154 154
155 it('Should list my (unlisted) videos', async function () { 155 it('Should list my (unlisted) videos', async function () {
156 const { total, data } = await servers[1].videosCommand.listMyVideos() 156 const { total, data } = await servers[1].videos.listMyVideos()
157 157
158 expect(total).to.equal(1) 158 expect(total).to.equal(1)
159 expect(data).to.have.lengthOf(1) 159 expect(data).to.have.lengthOf(1)
@@ -162,13 +162,13 @@ describe('Test video privacy', function () {
162 }) 162 })
163 163
164 it('Should not be able to get this unlisted video using its id', async function () { 164 it('Should not be able to get this unlisted video using its id', async function () {
165 await servers[1].videosCommand.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 165 await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
166 }) 166 })
167 167
168 it('Should be able to get this unlisted video using its uuid/shortUUID', async function () { 168 it('Should be able to get this unlisted video using its uuid/shortUUID', async function () {
169 for (const server of servers) { 169 for (const server of servers) {
170 for (const id of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) { 170 for (const id of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) {
171 const video = await server.videosCommand.get({ id }) 171 const video = await server.videos.get({ id })
172 172
173 expect(video.name).to.equal('unlisted video') 173 expect(video.name).to.equal('unlisted video')
174 } 174 }
@@ -182,13 +182,13 @@ describe('Test video privacy', function () {
182 name: 'unlisted video', 182 name: 'unlisted video',
183 privacy: VideoPrivacy.UNLISTED 183 privacy: VideoPrivacy.UNLISTED
184 } 184 }
185 await servers[0].videosCommand.upload({ attributes }) 185 await servers[0].videos.upload({ attributes })
186 186
187 await waitJobs(servers) 187 await waitJobs(servers)
188 }) 188 })
189 189
190 it('Should list my new unlisted video', async function () { 190 it('Should list my new unlisted video', async function () {
191 const { total, data } = await servers[0].videosCommand.listMyVideos() 191 const { total, data } = await servers[0].videos.listMyVideos()
192 192
193 expect(total).to.equal(3) 193 expect(total).to.equal(3)
194 expect(data).to.have.lengthOf(3) 194 expect(data).to.have.lengthOf(3)
@@ -197,13 +197,13 @@ describe('Test video privacy', function () {
197 }) 197 })
198 198
199 it('Should be able to get non-federated unlisted video from origin', async function () { 199 it('Should be able to get non-federated unlisted video from origin', async function () {
200 const video = await servers[0].videosCommand.get({ id: nonFederatedUnlistedVideoUUID }) 200 const video = await servers[0].videos.get({ id: nonFederatedUnlistedVideoUUID })
201 201
202 expect(video.name).to.equal('unlisted video') 202 expect(video.name).to.equal('unlisted video')
203 }) 203 })
204 204
205 it('Should not be able to get non-federated unlisted video from federated server', async function () { 205 it('Should not be able to get non-federated unlisted video from federated server', async function () {
206 await servers[1].videosCommand.get({ id: nonFederatedUnlistedVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 206 await servers[1].videos.get({ id: nonFederatedUnlistedVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
207 }) 207 })
208 }) 208 })
209 209
@@ -220,7 +220,7 @@ describe('Test video privacy', function () {
220 privacy: VideoPrivacy.PUBLIC 220 privacy: VideoPrivacy.PUBLIC
221 } 221 }
222 222
223 await servers[0].videosCommand.update({ id: privateVideoId, attributes }) 223 await servers[0].videos.update({ id: privateVideoId, attributes })
224 } 224 }
225 225
226 { 226 {
@@ -228,7 +228,7 @@ describe('Test video privacy', function () {
228 name: 'internal video becomes public', 228 name: 'internal video becomes public',
229 privacy: VideoPrivacy.PUBLIC 229 privacy: VideoPrivacy.PUBLIC
230 } 230 }
231 await servers[0].videosCommand.update({ id: internalVideoId, attributes }) 231 await servers[0].videos.update({ id: internalVideoId, attributes })
232 } 232 }
233 233
234 await waitJobs(servers) 234 await waitJobs(servers)
@@ -236,7 +236,7 @@ describe('Test video privacy', function () {
236 236
237 it('Should have this new public video listed on server 1 and 2', async function () { 237 it('Should have this new public video listed on server 1 and 2', async function () {
238 for (const server of servers) { 238 for (const server of servers) {
239 const { total, data } = await server.videosCommand.list() 239 const { total, data } = await server.videos.list()
240 expect(total).to.equal(2) 240 expect(total).to.equal(2)
241 expect(data).to.have.lengthOf(2) 241 expect(data).to.have.lengthOf(2)
242 242
@@ -258,20 +258,20 @@ describe('Test video privacy', function () {
258 it('Should set these videos as private and internal', async function () { 258 it('Should set these videos as private and internal', async function () {
259 this.timeout(10000) 259 this.timeout(10000)
260 260
261 await servers[0].videosCommand.update({ id: internalVideoId, attributes: { privacy: VideoPrivacy.PRIVATE } }) 261 await servers[0].videos.update({ id: internalVideoId, attributes: { privacy: VideoPrivacy.PRIVATE } })
262 await servers[0].videosCommand.update({ id: privateVideoId, attributes: { privacy: VideoPrivacy.INTERNAL } }) 262 await servers[0].videos.update({ id: privateVideoId, attributes: { privacy: VideoPrivacy.INTERNAL } })
263 263
264 await waitJobs(servers) 264 await waitJobs(servers)
265 265
266 for (const server of servers) { 266 for (const server of servers) {
267 const { total, data } = await server.videosCommand.list() 267 const { total, data } = await server.videos.list()
268 268
269 expect(total).to.equal(0) 269 expect(total).to.equal(0)
270 expect(data).to.have.lengthOf(0) 270 expect(data).to.have.lengthOf(0)
271 } 271 }
272 272
273 { 273 {
274 const { total, data } = await servers[0].videosCommand.listMyVideos() 274 const { total, data } = await servers[0].videos.listMyVideos()
275 expect(total).to.equal(3) 275 expect(total).to.equal(3)
276 expect(data).to.have.lengthOf(3) 276 expect(data).to.have.lengthOf(3)
277 277