mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix(team,repo,org,wiki,auth): detect a kept admin permission, validate topics up front, page public members, name disabled wikis, treat auth switch's account as --user
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
12 files changed
+289
-64
No files matched your search
@@ -134,3 +134,22 @@ func TestWikiCreateExplainsADisabledWiki(t *testing.T) {
|
||||
require.ErrorContains(t, err, "the wiki of alice/project is disabled")
|
||||
require.NotErrorAs(t, err, new(*NotFoundError))
|
||||
}
|
||||
|
||||
func TestWikiViewEditAndDeleteExplainADisabledWiki(t *testing.T) {
|
||||
client := newTestClient(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/api/v1/repos/alice/project" {
|
||||
_, _ = w.Write([]byte(`{"full_name":"alice/project","has_wiki":false}`))
|
||||
return
|
||||
}
|
||||
http.NotFound(w, r)
|
||||
}))
|
||||
service := Wiki{Client: client, Repository: "alice/project"}
|
||||
_, viewErr := service.View(context.Background(), "Home")
|
||||
_, _, editErr := service.Edit(context.Background(), "Home", WikiOptions{Body: "body"})
|
||||
deleteErr := service.Delete(context.Background(), "Home")
|
||||
for _, err := range []error{viewErr, editErr, deleteErr} {
|
||||
require.ErrorContains(t, err, "the wiki of alice/project is disabled")
|
||||
require.ErrorContains(t, err, "tea repo edit --enable-wiki")
|
||||
require.NotErrorAs(t, err, new(*NotFoundError))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user