Skip to content

Commit 439a0cc

Browse files
authored
Test more templates for if they contain an error (#27367)
1 parent e4313fe commit 439a0cc

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

models/fixtures/repo_unit.yml

+20
Original file line numberDiff line numberDiff line change
@@ -649,3 +649,23 @@
649649
repo_id: 49
650650
type: 2
651651
created_unix: 946684810
652+
653+
-
654+
id: 98
655+
repo_id: 1
656+
type: 8
657+
created_unix: 946684810
658+
659+
-
660+
id: 99
661+
repo_id: 1
662+
type: 9
663+
config: "{}"
664+
created_unix: 946684810
665+
666+
-
667+
id: 100
668+
repo_id: 1
669+
type: 10
670+
config: "{}"
671+
created_unix: 946684810

tests/integration/links_test.go

+33
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ func testLinksAsUser(userName string, t *testing.T) {
159159
"/releases/new",
160160
//"/wiki/_pages",
161161
"/wiki/?action=_new",
162+
"/activity",
162163
}
163164

164165
for _, repo := range apiRepos {
@@ -174,3 +175,35 @@ func TestLinksLogin(t *testing.T) {
174175

175176
testLinksAsUser("user2", t)
176177
}
178+
179+
func TestRepoLinks(t *testing.T) {
180+
defer tests.PrepareTestEnv(t)()
181+
182+
// repo1 has enabled almost features, so we can test most links
183+
repoLink := "/user2/repo1"
184+
links := []string{
185+
"/actions",
186+
"/packages",
187+
"/projects",
188+
}
189+
190+
// anonymous user
191+
for _, link := range links {
192+
req := NewRequest(t, "GET", repoLink+link)
193+
MakeRequest(t, req, http.StatusOK)
194+
}
195+
196+
// admin/owner user
197+
session := loginUser(t, "user1")
198+
for _, link := range links {
199+
req := NewRequest(t, "GET", repoLink+link)
200+
session.MakeRequest(t, req, http.StatusOK)
201+
}
202+
203+
// non-admin non-owner user
204+
session = loginUser(t, "user2")
205+
for _, link := range links {
206+
req := NewRequest(t, "GET", repoLink+link)
207+
session.MakeRequest(t, req, http.StatusOK)
208+
}
209+
}

0 commit comments

Comments
 (0)