diff options
author | Wicklow <wicklow@framasoft.org> | 2023-02-23 15:39:09 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-02-23 16:07:44 +0100 |
commit | 16ccb43767c45e74877ab7beaa4adb61a404c128 (patch) | |
tree | d61704e49131c6233cbc550b71f27212c1516db4 /server/tests/api/videos | |
parent | 918ba713e4e8014d7b995e61df0ecada934c6361 (diff) | |
download | PeerTube-16ccb43767c45e74877ab7beaa4adb61a404c128.tar.gz PeerTube-16ccb43767c45e74877ab7beaa4adb61a404c128.tar.zst PeerTube-16ccb43767c45e74877ab7beaa4adb61a404c128.zip |
Fix filters on playlists
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/video-playlists.ts | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index e8e653382..d9c5bdf16 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -114,7 +114,7 @@ describe('Test video playlists', function () { | |||
114 | await waitJobs(servers) | 114 | await waitJobs(servers) |
115 | }) | 115 | }) |
116 | 116 | ||
117 | describe('Get default playlists', function () { | 117 | describe('Check playlists filters and privacies', function () { |
118 | 118 | ||
119 | it('Should list video playlist privacies', async function () { | 119 | it('Should list video playlist privacies', async function () { |
120 | const privacies = await commands[0].getPrivacies() | 120 | const privacies = await commands[0].getPrivacies() |
@@ -123,9 +123,21 @@ describe('Test video playlists', function () { | |||
123 | expect(privacies[3]).to.equal('Private') | 123 | expect(privacies[3]).to.equal('Private') |
124 | }) | 124 | }) |
125 | 125 | ||
126 | it('Should list watch later playlist', async function () { | 126 | it('Should filter on playlist type', async function () { |
127 | this.timeout(30000) | ||
128 | |||
127 | const token = servers[0].accessToken | 129 | const token = servers[0].accessToken |
128 | 130 | ||
131 | await commands[0].create({ | ||
132 | attributes: { | ||
133 | displayName: 'my super playlist', | ||
134 | privacy: VideoPlaylistPrivacy.PUBLIC, | ||
135 | description: 'my super description', | ||
136 | thumbnailfile: 'thumbnail.jpg', | ||
137 | videoChannelId: servers[0].store.channel.id | ||
138 | } | ||
139 | }) | ||
140 | |||
129 | { | 141 | { |
130 | const body = await commands[0].listByAccount({ token, handle: 'root', playlistType: VideoPlaylistType.WATCH_LATER }) | 142 | const body = await commands[0].listByAccount({ token, handle: 'root', playlistType: VideoPlaylistType.WATCH_LATER }) |
131 | 143 | ||
@@ -136,13 +148,51 @@ describe('Test video playlists', function () { | |||
136 | expect(playlist.displayName).to.equal('Watch later') | 148 | expect(playlist.displayName).to.equal('Watch later') |
137 | expect(playlist.type.id).to.equal(VideoPlaylistType.WATCH_LATER) | 149 | expect(playlist.type.id).to.equal(VideoPlaylistType.WATCH_LATER) |
138 | expect(playlist.type.label).to.equal('Watch later') | 150 | expect(playlist.type.label).to.equal('Watch later') |
151 | expect(playlist.privacy.id).to.equal(VideoPlaylistPrivacy.PRIVATE) | ||
139 | } | 152 | } |
140 | 153 | ||
141 | { | 154 | { |
142 | const body = await commands[0].listByAccount({ token, handle: 'root', playlistType: VideoPlaylistType.REGULAR }) | 155 | const bodyList = await commands[0].list({ playlistType: VideoPlaylistType.WATCH_LATER }) |
156 | const bodyChannel = await commands[0].listByChannel({ handle: 'root_channel', playlistType: VideoPlaylistType.WATCH_LATER }) | ||
143 | 157 | ||
144 | expect(body.total).to.equal(0) | 158 | for (const body of [ bodyList, bodyChannel ]) { |
145 | expect(body.data).to.have.lengthOf(0) | 159 | expect(body.total).to.equal(0) |
160 | expect(body.data).to.have.lengthOf(0) | ||
161 | } | ||
162 | } | ||
163 | |||
164 | { | ||
165 | const bodyList = await commands[0].list({ playlistType: VideoPlaylistType.REGULAR }) | ||
166 | const bodyChannel = await commands[0].listByChannel({ handle: 'root_channel', playlistType: VideoPlaylistType.REGULAR }) | ||
167 | |||
168 | let playlist: VideoPlaylist = null | ||
169 | for (const body of [ bodyList, bodyChannel ]) { | ||
170 | |||
171 | expect(body.total).to.equal(1) | ||
172 | expect(body.data).to.have.lengthOf(1) | ||
173 | |||
174 | playlist = body.data[0] | ||
175 | expect(playlist.displayName).to.equal('my super playlist') | ||
176 | expect(playlist.privacy.id).to.equal(VideoPlaylistPrivacy.PUBLIC) | ||
177 | expect(playlist.type.id).to.equal(VideoPlaylistType.REGULAR) | ||
178 | } | ||
179 | |||
180 | await commands[0].update({ | ||
181 | playlistId: playlist.id, | ||
182 | attributes: { | ||
183 | privacy: VideoPlaylistPrivacy.PRIVATE | ||
184 | } | ||
185 | }) | ||
186 | } | ||
187 | |||
188 | { | ||
189 | const bodyList = await commands[0].list({ playlistType: VideoPlaylistType.REGULAR }) | ||
190 | const bodyChannel = await commands[0].listByChannel({ handle: 'root_channel', playlistType: VideoPlaylistType.REGULAR }) | ||
191 | |||
192 | for (const body of [ bodyList, bodyChannel ]) { | ||
193 | expect(body.total).to.equal(0) | ||
194 | expect(body.data).to.have.lengthOf(0) | ||
195 | } | ||
146 | } | 196 | } |
147 | 197 | ||
148 | { | 198 | { |