1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-10 04:27:22 +00:00

Added Description Field for Secrets and Variables (#33526)

Fixes #33484

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
John Smith
2025-03-18 03:24:54 +08:00
committed by GitHub
parent 9d7c02f9f7
commit 8f051d598c
20 changed files with 247 additions and 63 deletions

View File

@ -73,6 +73,33 @@ func TestAPIRepoSecrets(t *testing.T) {
}
})
t.Run("CreateWithDescription", func(t *testing.T) {
cases := []struct {
Name string
Description string
ExpectedStatus int
}{
{
Name: "no_description",
Description: "",
ExpectedStatus: http.StatusCreated,
},
{
Name: "description",
Description: "some description",
ExpectedStatus: http.StatusCreated,
},
}
for _, c := range cases {
req := NewRequestWithJSON(t, "PUT", fmt.Sprintf("/api/v1/repos/%s/actions/secrets/%s", repo.FullName(), c.Name), api.CreateOrUpdateSecretOption{
Data: "data",
Description: c.Description,
}).AddTokenAuth(token)
MakeRequest(t, req, c.ExpectedStatus)
}
})
t.Run("Update", func(t *testing.T) {
name := "update_secret"
url := fmt.Sprintf("/api/v1/repos/%s/actions/secrets/%s", repo.FullName(), name)