feat: update gitea vendor
runner nix smoke / nix label and flake smoke (push) Failing after 1m28s

This commit is contained in:
2026-09-26 21:18:24 +00:00
parent c439c1b948
commit d9b2a4e787
3538 changed files with 116131 additions and 44340 deletions
@@ -9,12 +9,12 @@ import (
"net/url"
"testing"
auth_model "code.gitea.io/gitea/models/auth"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/tests"
auth_model "gitea.dev/models/auth"
repo_model "gitea.dev/models/repo"
"gitea.dev/models/unittest"
user_model "gitea.dev/models/user"
api "gitea.dev/modules/structs"
"gitea.dev/tests"
"github.com/stretchr/testify/assert"
)
@@ -22,33 +22,34 @@ import (
func TestAPITopicSearch(t *testing.T) {
defer tests.PrepareTestEnv(t)()
searchURL, _ := url.Parse("/api/v1/topics/search")
var topics struct {
TopicNames []*api.TopicResponse `json:"topics"`
}
// search all topics
res := MakeRequest(t, NewRequest(t, "GET", searchURL.String()), http.StatusOK)
DecodeJSON(t, res, &topics)
topics := DecodeJSON(t, res, &struct {
TopicNames []*api.TopicResponse `json:"topics"`
}{})
assert.Len(t, topics.TopicNames, 6)
assert.Equal(t, "6", res.Header().Get("x-total-count"))
// pagination search topics first page
topics.TopicNames = nil
query := url.Values{"page": []string{"1"}, "limit": []string{"4"}}
searchURL.RawQuery = query.Encode()
res = MakeRequest(t, NewRequest(t, "GET", searchURL.String()), http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &struct {
TopicNames []*api.TopicResponse `json:"topics"`
}{})
assert.Len(t, topics.TopicNames, 4)
assert.Equal(t, "6", res.Header().Get("x-total-count"))
// pagination search topics second page
topics.TopicNames = nil
query = url.Values{"page": []string{"2"}, "limit": []string{"4"}}
searchURL.RawQuery = query.Encode()
res = MakeRequest(t, NewRequest(t, "GET", searchURL.String()), http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &struct {
TopicNames []*api.TopicResponse `json:"topics"`
}{})
assert.Len(t, topics.TopicNames, 2)
assert.Equal(t, "6", res.Header().Get("x-total-count"))
@@ -57,13 +58,17 @@ func TestAPITopicSearch(t *testing.T) {
query.Add("q", "topic")
searchURL.RawQuery = query.Encode()
res = MakeRequest(t, NewRequest(t, "GET", searchURL.String()), http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &struct {
TopicNames []*api.TopicResponse `json:"topics"`
}{})
assert.Len(t, topics.TopicNames, 2)
query.Set("q", "database")
searchURL.RawQuery = query.Encode()
res = MakeRequest(t, NewRequest(t, "GET", searchURL.String()), http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &struct {
TopicNames []*api.TopicResponse `json:"topics"`
}{})
if assert.Len(t, topics.TopicNames, 1) {
assert.EqualValues(t, 2, topics.TopicNames[0].ID)
assert.Equal(t, "database", topics.TopicNames[0].Name)
@@ -86,8 +91,7 @@ func TestAPIRepoTopic(t *testing.T) {
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/topics", user2.Name, repo2.Name)).
AddTokenAuth(token2)
res := MakeRequest(t, req, http.StatusOK)
var topics *api.TopicName
DecodeJSON(t, res, &topics)
topics := DecodeJSON(t, res, &api.TopicName{})
assert.ElementsMatch(t, []string{"topicname1", "topicname2"}, topics.TopicNames)
// Test delete a topic
@@ -111,7 +115,7 @@ func TestAPIRepoTopic(t *testing.T) {
req = NewRequest(t, "GET", url).
AddTokenAuth(token2)
res = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &api.TopicName{})
assert.ElementsMatch(t, []string{"topicname2", "golang", "topicname3"}, topics.TopicNames)
// Test replace topics
@@ -123,7 +127,7 @@ func TestAPIRepoTopic(t *testing.T) {
req = NewRequest(t, "GET", url).
AddTokenAuth(token2)
res = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &api.TopicName{})
assert.ElementsMatch(t, []string{"windows", "mac"}, topics.TopicNames)
// Test replace topics with something invalid
@@ -135,7 +139,7 @@ func TestAPIRepoTopic(t *testing.T) {
req = NewRequest(t, "GET", url).
AddTokenAuth(token2)
res = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &api.TopicName{})
assert.ElementsMatch(t, []string{"windows", "mac"}, topics.TopicNames)
// Test with some topics multiple times, less than 25 unique
@@ -147,7 +151,7 @@ func TestAPIRepoTopic(t *testing.T) {
req = NewRequest(t, "GET", url).
AddTokenAuth(token2)
res = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &api.TopicName{})
assert.Len(t, topics.TopicNames, 25)
// Test writing more topics than allowed
@@ -174,7 +178,7 @@ func TestAPIRepoTopic(t *testing.T) {
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/topics", org3.Name, repo3.Name)).
AddTokenAuth(token4)
res = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, res, &topics)
topics = DecodeJSON(t, res, &api.TopicName{})
assert.Empty(t, topics.TopicNames)
// Test add a topic to repo with write access (requires repo admin access)