mirror of https://github.com/go-gitea/gitea.git
adjust tests (5)
This commit is contained in:
parent
924e3d5f52
commit
40aae71221
|
@ -55,12 +55,24 @@ func TestRedirectsNoLogin(t *testing.T) {
|
|||
"/user2/repo1/src/master/directory/file.txt": "/user2/repo1/src/branch/master/directory/file.txt",
|
||||
"/user/avatar/Ghost/-1": "/assets/img/avatar_default.png",
|
||||
"/api/v1/swagger": "/api/swagger",
|
||||
}
|
||||
for link, redirectLink := range redirects {
|
||||
req := NewRequest(t, "GET", link)
|
||||
resp := MakeRequest(t, req, http.StatusSeeOther)
|
||||
assert.EqualValues(t, path.Join(setting.AppSubURL, redirectLink), test.RedirectURL(resp))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPermanentRedirectsNoLogin(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
redirects := map[string]string{
|
||||
"/user2/repo1": "/user2/repo1/code",
|
||||
"/user2/repo1/": "/user2/repo1/code",
|
||||
}
|
||||
for link, redirectLink := range redirects {
|
||||
req := NewRequest(t, "GET", link)
|
||||
resp := MakeRequest(t, req, http.StatusSeeOther)
|
||||
resp := MakeRequest(t, req, http.StatusMovedPermanently)
|
||||
assert.EqualValues(t, path.Join(setting.AppSubURL, redirectLink), test.RedirectURL(resp))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue