File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments