Test more templates for if they contain an error (#27367)
(cherry picked from commit439a0cca2c
) (cherry picked from commita4ee21cb5b
) (cherry picked from commit22a32ef309
) (cherry picked from commit7d74822400
)
This commit is contained in:
parent
b66322a5e3
commit
cb92fad0ef
2 changed files with 53 additions and 0 deletions
|
@ -649,3 +649,23 @@
|
||||||
repo_id: 49
|
repo_id: 49
|
||||||
type: 2
|
type: 2
|
||||||
created_unix: 946684810
|
created_unix: 946684810
|
||||||
|
|
||||||
|
-
|
||||||
|
id: 98
|
||||||
|
repo_id: 1
|
||||||
|
type: 8
|
||||||
|
created_unix: 946684810
|
||||||
|
|
||||||
|
-
|
||||||
|
id: 99
|
||||||
|
repo_id: 1
|
||||||
|
type: 9
|
||||||
|
config: "{}"
|
||||||
|
created_unix: 946684810
|
||||||
|
|
||||||
|
-
|
||||||
|
id: 100
|
||||||
|
repo_id: 1
|
||||||
|
type: 10
|
||||||
|
config: "{}"
|
||||||
|
created_unix: 946684810
|
||||||
|
|
|
@ -159,6 +159,7 @@ func testLinksAsUser(userName string, t *testing.T) {
|
||||||
"/releases/new",
|
"/releases/new",
|
||||||
//"/wiki/_pages",
|
//"/wiki/_pages",
|
||||||
"/wiki/?action=_new",
|
"/wiki/?action=_new",
|
||||||
|
"/activity",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, repo := range apiRepos {
|
for _, repo := range apiRepos {
|
||||||
|
@ -174,3 +175,35 @@ func TestLinksLogin(t *testing.T) {
|
||||||
|
|
||||||
testLinksAsUser("user2", t)
|
testLinksAsUser("user2", t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRepoLinks(t *testing.T) {
|
||||||
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
||||||
|
// repo1 has enabled almost features, so we can test most links
|
||||||
|
repoLink := "/user2/repo1"
|
||||||
|
links := []string{
|
||||||
|
"/actions",
|
||||||
|
"/packages",
|
||||||
|
"/projects",
|
||||||
|
}
|
||||||
|
|
||||||
|
// anonymous user
|
||||||
|
for _, link := range links {
|
||||||
|
req := NewRequest(t, "GET", repoLink+link)
|
||||||
|
MakeRequest(t, req, http.StatusOK)
|
||||||
|
}
|
||||||
|
|
||||||
|
// admin/owner user
|
||||||
|
session := loginUser(t, "user1")
|
||||||
|
for _, link := range links {
|
||||||
|
req := NewRequest(t, "GET", repoLink+link)
|
||||||
|
session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
}
|
||||||
|
|
||||||
|
// non-admin non-owner user
|
||||||
|
session = loginUser(t, "user2")
|
||||||
|
for _, link := range links {
|
||||||
|
req := NewRequest(t, "GET", repoLink+link)
|
||||||
|
session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue