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'
username: 'user_1',
password: 'super password'
}
- await createUser(server.url, server.accessToken, user.username, user.password)
+ await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
userAccessToken = await userLogin(server, user)
})
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 ])