aboutsummaryrefslogtreecommitdiffstats
path: root/tests/integration/api_repo_secrets_test.go
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2024-04-26 21:11:49 +0800
committerGitHub <noreply@github.com>2024-04-26 21:11:49 +0800
commit852547d0dc70299589c7bf8d00ea462ed709b8e5 (patch)
tree235003f72556874c6115ed21baca6ebecd74dacb /tests/integration/api_repo_secrets_test.go
parent993736d838c36e26951b6cfea9c6a549958addd1 (diff)
downloadgitea-852547d0dc70299589c7bf8d00ea462ed709b8e5.tar.gz
gitea-852547d0dc70299589c7bf8d00ea462ed709b8e5.zip
feat(api): enhance Actions Secrets Management API for repository (#30656)
- Add endpoint to list repository action secrets in API routes - Implement `ListActionsSecrets` function to retrieve action secrets from the database - Update Swagger documentation to include the new `/repos/{owner}/{repo}/actions/secrets` endpoint - Add `actions` package import and define new routes for actions, secrets, variables, and runners in `api.go`. - Refactor action-related API functions into `Action` struct methods in `org/action.go` and `repo/action.go`. - Remove `actionAPI` struct and related functions, replacing them with `NewAction()` calls. - Rename `variables.go` to `action.go` in `org` directory. - Delete `runners.go` and `secrets.go` in both `org` and `repo` directories, consolidating their content into `action.go`. - Update copyright year and add new imports in `org/action.go`. - Implement `API` interface in `services/actions/interface.go` for action-related methods. - Remove individual action-related functions and replace them with methods on the `Action` struct in `repo/action.go`. --------- Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Signed-off-by: appleboy <appleboy.tw@gmail.com>
Diffstat (limited to 'tests/integration/api_repo_secrets_test.go')
-rw-r--r--tests/integration/api_repo_secrets_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/integration/api_repo_secrets_test.go b/tests/integration/api_repo_secrets_test.go
index feb9bae2b2..c3074d9ece 100644
--- a/tests/integration/api_repo_secrets_test.go
+++ b/tests/integration/api_repo_secrets_test.go
@@ -24,6 +24,12 @@ func TestAPIRepoSecrets(t *testing.T) {
session := loginUser(t, user.Name)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
+ t.Run("List", func(t *testing.T) {
+ req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/secrets", repo.FullName())).
+ AddTokenAuth(token)
+ MakeRequest(t, req, http.StatusOK)
+ })
+
t.Run("Create", func(t *testing.T) {
cases := []struct {
Name string
@@ -31,7 +37,7 @@ func TestAPIRepoSecrets(t *testing.T) {
}{
{
Name: "",
- ExpectedStatus: http.StatusNotFound,
+ ExpectedStatus: http.StatusMethodNotAllowed,
},
{
Name: "-",