From 5660ad49b3255753cf59b605fa1d4642bce720aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dachary?= Date: Sun, 17 Oct 2021 16:25:50 -1000 Subject: [PATCH 1/2] api: integration test for nodeinfo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a minimal integration test for the nodeinfo endpoint added in https://github.com/go-gitea/gitea/pull/16953 Signed-off-by: Loïc Dachary --- integrations/api_nodeinfo_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 integrations/api_nodeinfo_test.go diff --git a/integrations/api_nodeinfo_test.go b/integrations/api_nodeinfo_test.go new file mode 100644 index 0000000000000..d98e027dd80fa --- /dev/null +++ b/integrations/api_nodeinfo_test.go @@ -0,0 +1,31 @@ +// Copyright 2018 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integrations + +import ( + "net/http" + "net/url" + "testing" + + "code.gitea.io/gitea/modules/setting" + api "code.gitea.io/gitea/modules/structs" + + "github.com/stretchr/testify/assert" +) + +func TestNodeinfo(t *testing.T) { + onGiteaRun(t, func(*testing.T, *url.URL) { + setting.Federation.Enabled = true + defer func() { + setting.Federation.Enabled = false + }() + + req := NewRequestf(t, "GET", "/api/v1/nodeinfo") + resp := MakeRequest(t, req, http.StatusOK) + var nodeinfo api.NodeInfo + DecodeJSON(t, resp, &nodeinfo) + assert.Equal(t, "gitea", nodeinfo.Software.Name) + }) +} From 85a7e7a43b81b9e7cfe62e19a730e0fa2de4be9b Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Sun, 17 Oct 2021 23:00:55 -0400 Subject: [PATCH 2/2] Update integrations/api_nodeinfo_test.go --- integrations/api_nodeinfo_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/api_nodeinfo_test.go b/integrations/api_nodeinfo_test.go index d98e027dd80fa..1d25dc0269288 100644 --- a/integrations/api_nodeinfo_test.go +++ b/integrations/api_nodeinfo_test.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Gitea Authors. All rights reserved. +// Copyright 2021 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file.