Skip to content

Commit 5660ad4

Browse files
Loïc Dacharytechknowlogick
Loïc Dachary
authored andcommitted
api: integration test for nodeinfo
Add a minimal integration test for the nodeinfo endpoint added in go-gitea#16953 Signed-off-by: Loïc Dachary <[email protected]>
1 parent 4a57c9e commit 5660ad4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

integrations/api_nodeinfo_test.go

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.
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)