mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix: send a team's permission before its units (Gitea 28), hidden private-org team reviews, long non-ASCII repo descriptions, -R NAME vs directory guard, flake fallback
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
12 files changed
+150
-8
No files matched your search
@@ -6,6 +6,7 @@ package services
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -118,3 +119,24 @@ func TestRepositoryReadme(t *testing.T) {
|
||||
_, _, err = (Repositories{Client: client}).Readme(context.Background(), "alice/project", "develp")
|
||||
require.EqualError(t, err, `branch "develp" not found in alice/project`)
|
||||
}
|
||||
|
||||
func TestRepositoryCreateSetsADescriptionBeyondTheSDKByteLimitByEdit(t *testing.T) {
|
||||
description := strings.Repeat("日", 800) // 2400 bytes, 800 characters: Gitea accepts it, the SDK would not
|
||||
var methods []string
|
||||
client := newTestClient(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
methods = append(methods, r.Method)
|
||||
body := requestJSON(t, r)
|
||||
switch r.Method {
|
||||
case http.MethodPost:
|
||||
require.Empty(t, body["description"])
|
||||
_, _ = w.Write([]byte(`{"id":1,"name":"project","full_name":"alice/project"}`))
|
||||
case http.MethodPatch:
|
||||
require.Equal(t, description, body["description"])
|
||||
_, _ = w.Write([]byte(`{"id":1,"name":"project","full_name":"alice/project","description":"` + description + `"}`))
|
||||
}
|
||||
}))
|
||||
created, err := (Repositories{Client: client}).Create(context.Background(), "", RepositoryOptions{Name: "project", Description: description})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []string{http.MethodPost, http.MethodPatch}, methods)
|
||||
require.Equal(t, description, created.Description)
|
||||
}
|
||||
Reference in new issue
Block a user