Skip to content

Commit dd61d75

Browse files
committed
add testcase as per 6543
Signed-off-by: Andrew Thornton <[email protected]>
1 parent ac9d4ab commit dd61d75

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

integrations/goget_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
"fmt"
9+
"net/http"
10+
"testing"
11+
12+
"code.gitea.io/gitea/modules/setting"
13+
"github.com/stretchr/testify/assert"
14+
)
15+
16+
func TestGoGet(t *testing.T) {
17+
defer prepareTestEnv(t)()
18+
19+
req := NewRequest(t, "GET", "/blah/glah/plah?go-get=1")
20+
resp := MakeRequest(t, req, http.StatusOK)
21+
22+
expected := fmt.Sprintf(`<!doctype html>
23+
<html>
24+
<head>
25+
<meta name="go-import" content="%[1]s:%[2]s/blah/glah git %[3]sblah/glah.git">
26+
<meta name="go-source" content="%[1]s:%[2]s/blah/glah _ %[3]sblah/glah/src/branch/master{/dir} %[3]sblah/glah/src/branch/master{/dir}/{file}#L{line}">
27+
</head>
28+
<body>
29+
go get --insecure %[1]s:%[2]s/blah/glah
30+
</body>
31+
</html>
32+
`, setting.Domain, setting.HTTPPort, setting.AppURL)
33+
34+
assert.Equal(t, expected, resp.Body.String())
35+
}

0 commit comments

Comments
 (0)