diff --git a/tests/integration/api_actions_permission_test.go b/tests/integration/api_actions_permission_test.go index 7aca43b2e1..072e2635a9 100644 --- a/tests/integration/api_actions_permission_test.go +++ b/tests/integration/api_actions_permission_test.go @@ -15,9 +15,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestActionUserSignIn(t *testing.T) { - defer tests.PrepareTestEnv(t)() - +func testActionUserSignIn(t *testing.T) { req := NewRequest(t, "GET", "/api/v1/user"). AddTokenAuth("8061e833a55f6fc0157c98b883e91fcfeeb1a71a") resp := MakeRequest(t, req, http.StatusOK) @@ -27,9 +25,7 @@ func TestActionUserSignIn(t *testing.T) { assert.Equal(t, "gitea-actions", u.UserName) } -func TestActionUserAccessPublicRepo(t *testing.T) { - defer tests.PrepareTestEnv(t)() - +func testActionUserAccessPublicRepo(t *testing.T) { req := NewRequestf(t, "GET", "/api/v1/repos/user2/repo1/raw/README.md"). AddTokenAuth("8061e833a55f6fc0157c98b883e91fcfeeb1a71a") resp := MakeRequest(t, req, http.StatusOK) @@ -43,10 +39,16 @@ func TestActionUserAccessPublicRepo(t *testing.T) { assert.Equal(t, "file", resp.Header().Get("x-gitea-object-type")) } -func TestActionUserNoAccessOtherPrivateRepo(t *testing.T) { - defer tests.PrepareTestEnv(t)() - +func testActionUserNoAccessOtherPrivateRepo(t *testing.T) { req := NewRequestf(t, "GET", "/api/v1/repos/user2/repo2/raw/README.md"). AddTokenAuth("8061e833a55f6fc0157c98b883e91fcfeeb1a71a") MakeRequest(t, req, http.StatusNotFound) } + +func TestActionUserAccessPermission(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + t.Run("ActionUserSignIn", testActionUserSignIn) + t.Run("ActionUserAccessPublicRepo", testActionUserAccessPublicRepo) + t.Run("ActionUserNoAccessOtherPrivateRepo", testActionUserNoAccessOtherPrivateRepo) +}