Skip to content

Commit d3871c6

Browse files
techknowlogickStelios Malathouras
authored and
Stelios Malathouras
committed
api: integration test for nodeinfo (go-gitea#17346)
1 parent ae362e4 commit d3871c6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

integrations/api_nodeinfo_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
5+
package integrations
6+
7+
import (
8+
"net/http"
9+
"net/url"
10+
"testing"
11+
12+
"code.gitea.io/gitea/modules/setting"
13+
api "code.gitea.io/gitea/modules/structs"
14+
15+
"github.com/stretchr/testify/assert"
16+
)
17+
18+
func TestNodeinfo(t *testing.T) {
19+
onGiteaRun(t, func(*testing.T, *url.URL) {
20+
setting.Federation.Enabled = true
21+
defer func() {
22+
setting.Federation.Enabled = false
23+
}()
24+
25+
req := NewRequestf(t, "GET", "/api/v1/nodeinfo")
26+
resp := MakeRequest(t, req, http.StatusOK)
27+
var nodeinfo api.NodeInfo
28+
DecodeJSON(t, resp, &nodeinfo)
29+
assert.Equal(t, "gitea", nodeinfo.Software.Name)
30+
})
31+
}

0 commit comments

Comments
 (0)