1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Make URL scheme unambiguous (#2408)

* Make URL scheme unambiguous

Redirect old routes to new routes

* Fix redirects to new URL scheme, and update template

* Fix branches/_new endpoints, and update integration test
This commit is contained in:
Ethan Koenig
2017-10-29 19:04:25 -07:00
committed by Lunny Xiao
parent 6e98812ecf
commit 513375c429
20 changed files with 279 additions and 144 deletions

View File

@@ -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",