[chore] make tests more cacheable by avoiding time.Now() (#656)

This commit is contained in:
tobi
2022-06-19 17:10:24 +02:00
committed by GitHub
parent f42d5d807c
commit 610395d5a5
3 changed files with 123 additions and 129 deletions

View File

@ -81,7 +81,7 @@ func (suite *MediaCleanupTestSuite) TestMediaCleanupNoArg() {
suite.NoError(err)
// the media should no longer be cached
suite.True(prunedAttachment.Cached)
suite.False(prunedAttachment.Cached)
}
func (suite *MediaCleanupTestSuite) TestMediaCleanupNotOldEnough() {
@ -90,7 +90,7 @@ func (suite *MediaCleanupTestSuite) TestMediaCleanupNotOldEnough() {
// set up the request
recorder := httptest.NewRecorder()
ctx := suite.newContext(recorder, http.MethodPost, []byte("{\"remote_cache_days\": 3}"), admin.EmojiPath, "application/json")
ctx := suite.newContext(recorder, http.MethodPost, []byte("{\"remote_cache_days\": 10000}"), admin.EmojiPath, "application/json")
// call the handler
suite.adminModule.MediaCleanupPOSTHandler(ctx)