mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor: remove features beyond the UX plan
Drop additions that the UX plan does not ask for: - the interactive label edit form; label edit now requires a flag - label clone and the skip mode of label creation it needed - repo rename rewriting the Git remote or tea.repository; it now warns that the remote still points to the old name - the extra "source" remote on clones of pull mirrors - run artifact download, which duplicates run download --zip - 256-color and 24-bit label swatches; colors stay ANSI 16 - config list --show-source (config get keeps it) - the membership and access GETs before team member/repo add and remove; Gitea's PUT and DELETE are idempotent label edit/delete keep --by-name: it is the only way to address a label whose name is a number that is also another label's ID. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
22 files changed
+69
-560
No files matched your search
@@ -7,6 +7,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -86,8 +87,6 @@ func TestTeamRepoAddTakesRepositoriesAsArguments(t *testing.T) {
|
||||
switch r.Method + " " + r.URL.Path {
|
||||
case "GET /api/v1/teams/5":
|
||||
_, _ = w.Write([]byte(`{"id":5,"name":"devs","permission":"none","organization":{"username":"acme"}}`))
|
||||
case "GET /api/v1/teams/5/repos/acme/service", "GET /api/v1/teams/5/repos/acme/website":
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
case "PUT /api/v1/teams/5/repos/acme/service", "PUT /api/v1/teams/5/repos/acme/website":
|
||||
granted = append(granted, r.URL.Path)
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
@@ -182,18 +181,14 @@ func TestTeamPermissionSetsEveryUnit(t *testing.T) {
|
||||
require.Equal(t, map[string]any{"permission": "read", "units_map": wikiWrite}, sent[1])
|
||||
}
|
||||
|
||||
func TestTeamMemberRemoveNamesMembersAndSkipsOthers(t *testing.T) {
|
||||
func TestTeamMemberRemoveConfirmsOnce(t *testing.T) {
|
||||
var removed []string
|
||||
server := newAuthenticatedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method + " " + r.URL.Path {
|
||||
case "GET /api/v1/teams/5":
|
||||
_, _ = w.Write([]byte(`{"id":5,"name":"devs","organization":{"username":"acme"}}`))
|
||||
case "GET /api/v1/teams/5/members/carol":
|
||||
_, _ = w.Write([]byte(`{"login":"carol"}`))
|
||||
case "GET /api/v1/teams/5/members/dave":
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
case "DELETE /api/v1/teams/5/members/carol":
|
||||
removed = append(removed, "carol")
|
||||
case "DELETE /api/v1/teams/5/members/carol", "DELETE /api/v1/teams/5/members/dave":
|
||||
removed = append(removed, path.Base(r.URL.Path))
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
default:
|
||||
t.Errorf("unexpected request %s %s", r.Method, r.URL.Path)
|
||||
@@ -205,7 +200,7 @@ func TestTeamMemberRemoveNamesMembersAndSkipsOthers(t *testing.T) {
|
||||
prompt := &scriptedPrompter{accept: true}
|
||||
deps.Prompter = prompt
|
||||
require.NoError(t, Execute(context.Background(), deps, []string{"team", "member", "remove", "5", "carol", "dave"}))
|
||||
require.Equal(t, []string{"Remove carol from team acme/devs?"}, prompt.confirmations)
|
||||
require.Equal(t, []string{"carol"}, removed)
|
||||
require.Equal(t, "! dave is not a member of team acme/devs\n✓ Removed carol from team acme/devs\n", withoutANSI(diagnostics.String()))
|
||||
require.Equal(t, []string{"Remove carol and dave from team acme/devs?"}, prompt.confirmations)
|
||||
require.Equal(t, []string{"carol", "dave"}, removed)
|
||||
require.Equal(t, "✓ Removed carol from team acme/devs\n✓ Removed dave from team acme/devs\n", withoutANSI(diagnostics.String()))
|
||||
}
|
||||
Reference in new issue
Block a user