summaryrefslogtreecommitdiffstats
path: root/integrations/links_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrations/links_test.go')
-rw-r--r--integrations/links_test.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/integrations/links_test.go b/integrations/links_test.go
index 27e4054694..7eaf1c51ef 100644
--- a/integrations/links_test.go
+++ b/integrations/links_test.go
@@ -10,6 +10,8 @@ import (
"testing"
api "code.gitea.io/sdk/gitea"
+
+ "github.com/stretchr/testify/assert"
)
func TestLinksNoLogin(t *testing.T) {
@@ -38,6 +40,20 @@ func TestLinksNoLogin(t *testing.T) {
}
}
+func TestRedirectsNoLogin(t *testing.T) {
+ prepareTestEnv(t)
+
+ var redirects = map[string]string{
+ "/user2/repo1/commits/master": "/user2/repo1/commits/branch/master",
+ "/user2/repo1/src/master": "/user2/repo1/src/branch/master",
+ }
+ for link, redirectLink := range redirects {
+ req := NewRequest(t, "GET", link)
+ resp := MakeRequest(t, req, http.StatusFound)
+ assert.EqualValues(t, redirectLink, RedirectURL(t, resp))
+ }
+}
+
func testLinksAsUser(userName string, t *testing.T) {
var links = []string{
"/explore/repos",
@@ -99,7 +115,7 @@ func testLinksAsUser(userName string, t *testing.T) {
"",
"/issues",
"/pulls",
- "/commits/master",
+ "/commits/branch/master",
"/graph",
"/settings",
"/settings/collaboration",