Fix various bugs (#35684) (#35696)

Backport #35684 by wxiaoguang
This commit is contained in:
Giteabot
2025-10-19 02:26:03 +08:00
committed by GitHub
parent f71df88a6b
commit 4af1d58c86
15 changed files with 98 additions and 86 deletions

View File

@@ -131,9 +131,5 @@ func TestAPIRepoSecrets(t *testing.T) {
req = NewRequest(t, "DELETE", url).
AddTokenAuth(token)
MakeRequest(t, req, http.StatusNotFound)
req = NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/repos/%s/actions/secrets/000", repo.FullName())).
AddTokenAuth(token)
MakeRequest(t, req, http.StatusBadRequest)
})
}

View File

@@ -92,9 +92,5 @@ func TestAPIUserSecrets(t *testing.T) {
req = NewRequest(t, "DELETE", url).
AddTokenAuth(token)
MakeRequest(t, req, http.StatusNotFound)
req = NewRequest(t, "DELETE", "/api/v1/user/actions/secrets/000").
AddTokenAuth(token)
MakeRequest(t, req, http.StatusBadRequest)
})
}

View File

@@ -497,9 +497,13 @@ func TestIssueRedirect(t *testing.T) {
resp = session.MakeRequest(t, req, http.StatusSeeOther)
assert.Equal(t, "/user2/repo1/pulls/2", test.RedirectURL(resp))
repoUnit := unittest.AssertExistsAndLoadBean(t, &repo_model.RepoUnit{RepoID: 1, Type: unit.TypeIssues})
// by the way, test PR redirection
req = NewRequest(t, "GET", "/user2/repo1/pulls/1")
resp = session.MakeRequest(t, req, http.StatusSeeOther)
assert.Equal(t, "/user2/repo1/issues/1", test.RedirectURL(resp))
// disable issue unit, it will be reset
// disable issue unit
repoUnit := unittest.AssertExistsAndLoadBean(t, &repo_model.RepoUnit{RepoID: 1, Type: unit.TypeIssues})
_, err := db.DeleteByID[repo_model.RepoUnit](t.Context(), repoUnit.ID)
assert.NoError(t, err)