Skip to content

Test more templates for if they contain an error #27367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions models/fixtures/repo_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -649,3 +649,23 @@
repo_id: 49
type: 2
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
33 changes: 33 additions & 0 deletions tests/integration/links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func testLinksAsUser(userName string, t *testing.T) {
"/releases/new",
//"/wiki/_pages",
"/wiki/?action=_new",
"/activity",
}

for _, repo := range apiRepos {
Expand All @@ -174,3 +175,35 @@ func TestLinksLogin(t *testing.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)
}
}