]> source.dussan.org Git - gitea.git/commitdiff
Fix heatmap test (#17381)
authorLunny Xiao <xiaolunwen@gmail.com>
Thu, 21 Oct 2021 06:37:40 +0000 (14:37 +0800)
committerGitHub <noreply@github.com>
Thu, 21 Oct 2021 06:37:40 +0000 (14:37 +0800)
integrations/api_user_heatmap_test.go

index a0f0552a17944be398ec659f89119ae07d1f86ed..019cf7dcac583a24ec7ba21619a1d6b105ad7bdc 100644 (file)
@@ -8,8 +8,10 @@ import (
        "fmt"
        "net/http"
        "testing"
+       "time"
 
        "code.gitea.io/gitea/models"
+       "code.gitea.io/gitea/modules/timeutil"
 
        "github.com/stretchr/testify/assert"
 )
@@ -20,6 +22,10 @@ func TestUserHeatmap(t *testing.T) {
        normalUsername := "user2"
        session := loginUser(t, adminUsername)
 
+       var fakeNow = time.Date(2011, 10, 20, 0, 0, 0, 0, time.Local)
+       timeutil.Set(fakeNow)
+       defer timeutil.Unset()
+
        urlStr := fmt.Sprintf("/api/v1/users/%s/heatmap", normalUsername)
        req := NewRequest(t, "GET", urlStr)
        resp := session.MakeRequest(t, req, http.StatusOK)