You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

api_nodeinfo_test.go 743B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2021 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.
  4. package integrations
  5. import (
  6. "net/http"
  7. "net/url"
  8. "testing"
  9. "code.gitea.io/gitea/modules/setting"
  10. api "code.gitea.io/gitea/modules/structs"
  11. "github.com/stretchr/testify/assert"
  12. )
  13. func TestNodeinfo(t *testing.T) {
  14. onGiteaRun(t, func(*testing.T, *url.URL) {
  15. setting.Federation.Enabled = true
  16. defer func() {
  17. setting.Federation.Enabled = false
  18. }()
  19. req := NewRequestf(t, "GET", "/api/v1/nodeinfo")
  20. resp := MakeRequest(t, req, http.StatusOK)
  21. var nodeinfo api.NodeInfo
  22. DecodeJSON(t, resp, &nodeinfo)
  23. assert.Equal(t, "gitea", nodeinfo.Software.Name)
  24. })
  25. }