diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-10-29 19:04:25 -0700 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-10-30 10:04:25 +0800 |
commit | 513375c429435ba60a667b219bdfb00e5b760b38 (patch) | |
tree | 9f516c8d0ebbdc66808c9017df7db2ff9aa34b57 /integrations/links_test.go | |
parent | 6e98812ecf4efb6f53d72414ca8f67b14fac6595 (diff) | |
download | gitea-513375c429435ba60a667b219bdfb00e5b760b38.tar.gz gitea-513375c429435ba60a667b219bdfb00e5b760b38.zip |
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
Diffstat (limited to 'integrations/links_test.go')
-rw-r--r-- | integrations/links_test.go | 18 |
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", |