aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-11 15:38:53 +0200
committerChocobozzz <me@florianbigard.com>2019-04-11 15:38:53 +0200
commit8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98 (patch)
treee04f1da52f9377cf6ce820425c0de6e57ab57fc6 /server/tests
parent76062d9f96e06a23a2efc8a727ea9c5394d21466 (diff)
downloadPeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.tar.gz
PeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.tar.zst
PeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.zip
Add ability to limit videos history size
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/videos/videos-history.ts34
1 files changed, 32 insertions, 2 deletions
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index f654a422b..f7d3a6aeb 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -7,14 +7,15 @@ import {
7 flushTests, 7 flushTests,
8 getVideosListWithToken, 8 getVideosListWithToken,
9 getVideoWithToken, 9 getVideoWithToken,
10 killallServers, 10 killallServers, reRunServer,
11 runServer, 11 runServer,
12 searchVideoWithToken, 12 searchVideoWithToken,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 updateMyUser, 15 updateMyUser,
16 uploadVideo, 16 uploadVideo,
17 userLogin 17 userLogin,
18 wait
18} from '../../../../shared/utils' 19} from '../../../../shared/utils'
19import { Video, VideoDetails } from '../../../../shared/models/videos' 20import { Video, VideoDetails } from '../../../../shared/models/videos'
20import { listMyVideosHistory, removeMyVideosHistory, userWatchVideo } from '../../../../shared/utils/videos/video-history' 21import { listMyVideosHistory, removeMyVideosHistory, userWatchVideo } from '../../../../shared/utils/videos/video-history'
@@ -192,6 +193,35 @@ describe('Test videos history', function () {
192 expect(videos[1].name).to.equal('video 3') 193 expect(videos[1].name).to.equal('video 3')
193 }) 194 })
194 195
196 it('Should not clean old history', async function () {
197 this.timeout(50000)
198
199 killallServers([ server ])
200
201 await reRunServer(server, { history: { videos: { max_age: '10 days' } } })
202
203 await wait(6000)
204
205 // Should still have history
206
207 const res = await listMyVideosHistory(server.url, server.accessToken)
208
209 expect(res.body.total).to.equal(2)
210 })
211
212 it('Should clean old history', async function () {
213 this.timeout(50000)
214
215 killallServers([ server ])
216
217 await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } })
218
219 await wait(6000)
220
221 const res = await listMyVideosHistory(server.url, server.accessToken)
222 expect(res.body.total).to.equal(0)
223 })
224
195 after(async function () { 225 after(async function () {
196 killallServers([ server ]) 226 killallServers([ server ])
197 227