From 8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Apr 2019 15:38:53 +0200 Subject: Add ability to limit videos history size --- server/tests/api/videos/videos-history.ts | 34 +++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'server/tests/api/videos') 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 { flushTests, getVideosListWithToken, getVideoWithToken, - killallServers, + killallServers, reRunServer, runServer, searchVideoWithToken, ServerInfo, setAccessTokensToServers, updateMyUser, uploadVideo, - userLogin + userLogin, + wait } from '../../../../shared/utils' import { Video, VideoDetails } from '../../../../shared/models/videos' import { listMyVideosHistory, removeMyVideosHistory, userWatchVideo } from '../../../../shared/utils/videos/video-history' @@ -192,6 +193,35 @@ describe('Test videos history', function () { expect(videos[1].name).to.equal('video 3') }) + it('Should not clean old history', async function () { + this.timeout(50000) + + killallServers([ server ]) + + await reRunServer(server, { history: { videos: { max_age: '10 days' } } }) + + await wait(6000) + + // Should still have history + + const res = await listMyVideosHistory(server.url, server.accessToken) + + expect(res.body.total).to.equal(2) + }) + + it('Should clean old history', async function () { + this.timeout(50000) + + killallServers([ server ]) + + await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } }) + + await wait(6000) + + const res = await listMyVideosHistory(server.url, server.accessToken) + expect(res.body.total).to.equal(0) + }) + after(async function () { killallServers([ server ]) -- cgit v1.2.3