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:
bircni committed 2026-10-18 20:40:25 +02:00
1 parent 339527b26c
commit dd2ec74d96
12 files changed
+289 -64

No files matched your search

+19
View File
@@ -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))
}
}