|
|
@ -7,9 +7,11 @@ package models |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"testing" |
|
|
|
"testing" |
|
|
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/db" |
|
|
|
"code.gitea.io/gitea/models/db" |
|
|
|
"code.gitea.io/gitea/modules/json" |
|
|
|
"code.gitea.io/gitea/modules/json" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/timeutil" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert" |
|
|
|
"github.com/stretchr/testify/assert" |
|
|
|
) |
|
|
|
) |
|
|
@ -39,6 +41,10 @@ func TestGetUserHeatmapDataByUser(t *testing.T) { |
|
|
|
// Prepare
|
|
|
|
// Prepare
|
|
|
|
assert.NoError(t, db.PrepareTestDatabase()) |
|
|
|
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 { |
|
|
|
for i, tc := range testCases { |
|
|
|
user := db.AssertExistsAndLoadBean(t, &User{ID: tc.userID}).(*User) |
|
|
|
user := db.AssertExistsAndLoadBean(t, &User{ID: tc.userID}).(*User) |
|
|
|
|
|
|
|
|
|
|
|