From 038e1db4dfc7a7fc0a8675f66f6be9a3dd5f10c2 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 9 May 2021 22:50:06 +0100 Subject: Return go-get info on subdirs (#15642) This PR is an alternative to #15628 and makes the go get handler a handler. Fix #15625 Close #15628 Signed-off-by: Andrew Thornton --- integrations/goget_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 integrations/goget_test.go (limited to 'integrations') diff --git a/integrations/goget_test.go b/integrations/goget_test.go new file mode 100644 index 0000000000..1003d71023 --- /dev/null +++ b/integrations/goget_test.go @@ -0,0 +1,35 @@ +// 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. + +package integrations + +import ( + "fmt" + "net/http" + "testing" + + "code.gitea.io/gitea/modules/setting" + "github.com/stretchr/testify/assert" +) + +func TestGoGet(t *testing.T) { + defer prepareTestEnv(t)() + + req := NewRequest(t, "GET", "/blah/glah/plah?go-get=1") + resp := MakeRequest(t, req, http.StatusOK) + + expected := fmt.Sprintf(` + + + + + + + go get --insecure %[1]s:%[2]s/blah/glah + + +`, setting.Domain, setting.HTTPPort, setting.AppURL) + + assert.Equal(t, expected, resp.Body.String()) +} -- cgit v1.2.3