diff options
author | John Olheiser <john.olheiser@gmail.com> | 2021-10-18 15:12:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 21:12:26 +0100 |
commit | c59afa752d9746af6d870635ce3baaaff67b8027 (patch) | |
tree | 0e85620735e6fcfaf0c7264b16deb63ddb5d1fd7 /models | |
parent | f0376b7e020f0e7a790e4ee801db17f1f4bcd994 (diff) | |
download | gitea-c59afa752d9746af6d870635ce3baaaff67b8027.tar.gz gitea-c59afa752d9746af6d870635ce3baaaff67b8027.zip |
Allow mocking timeutil (#17354)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'models')
-rw-r--r-- | models/user_heatmap_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/user_heatmap_test.go b/models/user_heatmap_test.go index c40e341593..8d2002b1a0 100644 --- a/models/user_heatmap_test.go +++ b/models/user_heatmap_test.go @@ -7,9 +7,11 @@ package models import ( "fmt" "testing" + "time" "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/modules/json" + "code.gitea.io/gitea/modules/timeutil" "github.com/stretchr/testify/assert" ) @@ -39,6 +41,10 @@ func TestGetUserHeatmapDataByUser(t *testing.T) { // Prepare assert.NoError(t, db.PrepareTestDatabase()) + // Mock time + timeutil.Set(time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC)) + defer timeutil.Unset() + for i, tc := range testCases { user := db.AssertExistsAndLoadBean(t, &User{ID: tc.userID}).(*User) |