本站源代码
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

33 lignes
877B

  1. // Copyright 2018 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.package models
  4. package integrations
  5. import (
  6. "fmt"
  7. "net/http"
  8. "testing"
  9. "code.gitea.io/gitea/models"
  10. "github.com/stretchr/testify/assert"
  11. )
  12. func TestUserHeatmap(t *testing.T) {
  13. prepareTestEnv(t)
  14. adminUsername := "user1"
  15. normalUsername := "user2"
  16. session := loginUser(t, adminUsername)
  17. urlStr := fmt.Sprintf("/api/v1/users/%s/heatmap", normalUsername)
  18. req := NewRequest(t, "GET", urlStr)
  19. resp := session.MakeRequest(t, req, http.StatusOK)
  20. var heatmap []*models.UserHeatmapData
  21. DecodeJSON(t, resp, &heatmap)
  22. var dummyheatmap []*models.UserHeatmapData
  23. dummyheatmap = append(dummyheatmap, &models.UserHeatmapData{Timestamp: 1571616000, Contributions: 1})
  24. assert.Equal(t, dummyheatmap, heatmap)
  25. }
上海开阖软件有限公司 沪ICP备12045867号-1