Skip to content

Commit

Permalink
renaming to match original names prior to the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
RickleAndMortimer committed Sep 26, 2023
1 parent b64b8b8 commit dde3ba2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 56 deletions.
16 changes: 8 additions & 8 deletions github/actions_permissions_enterprise.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ func (a ActionsPermissionsEnterprise) String() string {
return Stringify(a)
}

// GetActionsPermissionsForEnterprise gets the GitHub Actions permissions policy for an enterprise.
// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise.
//
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise
func (s *ActionsService) GetActionsPermissionsForEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) {
func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise)

req, err := s.client.NewRequest("GET", u, nil)
Expand All @@ -49,10 +49,10 @@ func (s *ActionsService) GetActionsPermissionsForEnterprise(ctx context.Context,
return permissions, resp, nil
}

// EditActionsPermissionsForEnterprise sets the permissions policy in an enterprise.
// EditActionsPermissionsInEnterprise sets the permissions policy in an enterprise.
//
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-github-actions-permissions-for-an-enterprise
func (s *ActionsService) EditActionsPermissionsForEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) {
func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise)
req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise)
if err != nil {
Expand Down Expand Up @@ -151,10 +151,10 @@ func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner
return resp, nil
}

// GetActionsAllowedForEnterprise gets the actions that are allowed in an enterprise.
// GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise.
//
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise
func (s *ActionsService) GetActionsAllowedForEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) {
func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise)

req, err := s.client.NewRequest("GET", u, nil)
Expand All @@ -171,10 +171,10 @@ func (s *ActionsService) GetActionsAllowedForEnterprise(ctx context.Context, ent
return actionsAllowed, resp, nil
}

// EditActionsAllowedForEnterprise sets the actions that are allowed in an enterprise.
// EditActionsAllowedInEnterprise sets the actions that are allowed in an enterprise.
//
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise
func (s *ActionsService) EditActionsAllowedForEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) {
func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) {
u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise)
req, err := s.client.NewRequest("PUT", u, actionsAllowed)
if err != nil {
Expand Down
56 changes: 28 additions & 28 deletions github/actions_permissions_enterprise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/google/go-cmp/cmp"
)

func TestActionsService_GetActionsPermissionsForEnterprise(t *testing.T) {
func TestActionsService_GetActionsPermissionsInEnterprise(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

Expand All @@ -25,31 +25,31 @@ func TestActionsService_GetActionsPermissionsForEnterprise(t *testing.T) {
})

ctx := context.Background()
ent, _, err := client.Actions.GetActionsPermissionsForEnterprise(ctx, "e")
ent, _, err := client.Actions.GetActionsPermissionsInEnterprise(ctx, "e")
if err != nil {
t.Errorf("Actions.GetActionsPermissionsForEnterprise returned error: %v", err)
t.Errorf("Actions.GetActionsPermissionsInEnterprise returned error: %v", err)
}
want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("all")}
if !cmp.Equal(ent, want) {
t.Errorf("Actions.GetActionsPermissionsForEnterprise returned %+v, want %+v", ent, want)
t.Errorf("Actions.GetActionsPermissionsInEnterprise returned %+v, want %+v", ent, want)
}

const methodName = "GetActionsPermissionsForEnterprise"
const methodName = "GetActionsPermissionsInEnterprise"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Actions.GetActionsPermissionsForEnterprise(ctx, "\n")
_, _, err = client.Actions.GetActionsPermissionsInEnterprise(ctx, "\n")
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Actions.GetActionsPermissionsForEnterprise(ctx, "e")
got, resp, err := client.Actions.GetActionsPermissionsInEnterprise(ctx, "e")
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}

func TestActionsService_EditActionsPermissionsForEnterprise(t *testing.T) {
func TestActionsService_EditActionsPermissionsInEnterprise(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

Expand All @@ -68,24 +68,24 @@ func TestActionsService_EditActionsPermissionsForEnterprise(t *testing.T) {
})

ctx := context.Background()
ent, _, err := client.Actions.EditActionsPermissionsForEnterprise(ctx, "e", *input)
ent, _, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, "e", *input)
if err != nil {
t.Errorf("Actions.EditActionsPermissionsForEnterprise returned error: %v", err)
t.Errorf("Actions.EditActionsPermissionsInEnterprise returned error: %v", err)
}

want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("selected")}
if !cmp.Equal(ent, want) {
t.Errorf("Actions.EditActionsPermissionsForEnterprise returned %+v, want %+v", ent, want)
t.Errorf("Actions.EditActionsPermissionsInEnterprise returned %+v, want %+v", ent, want)
}

const methodName = "EditActionsPermissionsForEnterprise"
const methodName = "EditActionsPermissionsInEnterprise"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Actions.EditActionsPermissionsForEnterprise(ctx, "\n", *input)
_, _, err = client.Actions.EditActionsPermissionsInEnterprise(ctx, "\n", *input)
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Actions.EditActionsPermissionsForEnterprise(ctx, "e", *input)
got, resp, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, "e", *input)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
Expand Down Expand Up @@ -220,7 +220,7 @@ func TestActionsService_RemoveEnabledOrgInEnterprise(t *testing.T) {
})
}

func TestActionsService_GetActionsAllowedForEnterprise(t *testing.T) {
func TestActionsService_GetActionsAllowedInEnterprise(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

Expand All @@ -230,31 +230,31 @@ func TestActionsService_GetActionsAllowedForEnterprise(t *testing.T) {
})

ctx := context.Background()
ent, _, err := client.Actions.GetActionsAllowedForEnterprise(ctx, "e")
ent, _, err := client.Actions.GetActionsAllowedInEnterprise(ctx, "e")
if err != nil {
t.Errorf("Actions.GetActionsAllowedForEnterprise returned error: %v", err)
t.Errorf("Actions.GetActionsAllowedInEnterprise returned error: %v", err)
}
want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}}
if !cmp.Equal(ent, want) {
t.Errorf("Actions.GetActionsAllowedForEnterprise returned %+v, want %+v", ent, want)
t.Errorf("Actions.GetActionsAllowedInEnterprise returned %+v, want %+v", ent, want)
}

const methodName = "GetActionsAllowedForEnterprise"
const methodName = "GetActionsAllowedInEnterprise"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Actions.GetActionsAllowedForEnterprise(ctx, "\n")
_, _, err = client.Actions.GetActionsAllowedInEnterprise(ctx, "\n")
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Actions.GetActionsAllowedForEnterprise(ctx, "e")
got, resp, err := client.Actions.GetActionsAllowedInEnterprise(ctx, "e")
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}

func TestActionsService_EditActionsAllowedForEnterprise(t *testing.T) {
func TestActionsService_EditActionsAllowedInEnterprise(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}}
Expand All @@ -272,24 +272,24 @@ func TestActionsService_EditActionsAllowedForEnterprise(t *testing.T) {
})

ctx := context.Background()
ent, _, err := client.Actions.EditActionsAllowedForEnterprise(ctx, "e", *input)
ent, _, err := client.Actions.EditActionsAllowedInEnterprise(ctx, "e", *input)
if err != nil {
t.Errorf("Actions.EditActionsAllowedForEnterprise returned error: %v", err)
t.Errorf("Actions.EditActionsAllowedInEnterprise returned error: %v", err)
}

want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}}
if !cmp.Equal(ent, want) {
t.Errorf("Actions.EditActionsAllowedForEnterprise returned %+v, want %+v", ent, want)
t.Errorf("Actions.EditActionsAllowedInEnterprise returned %+v, want %+v", ent, want)
}

const methodName = "EditActionsAllowedForEnterprise"
const methodName = "EditActionsAllowedInEnterprise"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Actions.EditActionsAllowedForEnterprise(ctx, "\n", *input)
_, _, err = client.Actions.EditActionsAllowedInEnterprise(ctx, "\n", *input)
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Actions.EditActionsAllowedForEnterprise(ctx, "e", *input)
got, resp, err := client.Actions.EditActionsAllowedInEnterprise(ctx, "e", *input)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
Expand Down
8 changes: 4 additions & 4 deletions github/actions_permissions_orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string,
// ListEnabledRepos lists the selected repositories that are enabled for GitHub Actions in an organization.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization
func (s *ActionsService) ListEnabledRepos(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) {
func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) {
u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner)
u, err := addOptions(u, opts)
if err != nil {
Expand All @@ -108,7 +108,7 @@ func (s *ActionsService) ListEnabledRepos(ctx context.Context, owner string, opt
// SetEnabledRepos replaces the list of selected repositories that are enabled for GitHub Actions in an organization..
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization
func (s *ActionsService) SetEnabledRepos(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) {
func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) {
u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner)

req, err := s.client.NewRequest("PUT", u, struct {
Expand All @@ -129,7 +129,7 @@ func (s *ActionsService) SetEnabledRepos(ctx context.Context, owner string, repo
// AddEnabledRepos adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization
func (s *ActionsService) AddEnabledRepos(ctx context.Context, owner string, repositoryID int64) (*Response, error) {
func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) {
u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID)

req, err := s.client.NewRequest("PUT", u, nil)
Expand All @@ -148,7 +148,7 @@ func (s *ActionsService) AddEnabledRepos(ctx context.Context, owner string, repo
// RemoveEnabledRepo removes a single repository from the list of enabled repos for GitHub Actions in an organization.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization
func (s *ActionsService) RemoveEnabledRepo(ctx context.Context, owner string, repositoryID int64) (*Response, error) {
func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) {
u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID)

req, err := s.client.NewRequest("DELETE", u, nil)
Expand Down
32 changes: 16 additions & 16 deletions github/actions_permissions_orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestActionsService_EditActionsPermissions(t *testing.T) {
})
}

func TestActionsService_ListEnabledRepos(t *testing.T) {
func TestActionsService_ListEnabledReposInOrg(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

Expand All @@ -109,7 +109,7 @@ func TestActionsService_ListEnabledRepos(t *testing.T) {
opt := &ListOptions{
Page: 1,
}
got, _, err := client.Actions.ListEnabledRepos(ctx, "o", opt)
got, _, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt)
if err != nil {
t.Errorf("Actions.ListEnabledRepos returned error: %v", err)
}
Expand All @@ -124,20 +124,20 @@ func TestActionsService_ListEnabledRepos(t *testing.T) {

const methodName = "ListEnabledRepos"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Actions.ListEnabledRepos(ctx, "\n", opt)
_, _, err = client.Actions.ListEnabledReposInOrg(ctx, "\n", opt)
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Actions.ListEnabledRepos(ctx, "o", opt)
got, resp, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
}

func TestActionsService_SetEnabledRepos(t *testing.T) {
func TestActionsService_SetEnabledReposInOrg(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

Expand All @@ -149,24 +149,24 @@ func TestActionsService_SetEnabledRepos(t *testing.T) {
})

ctx := context.Background()
_, err := client.Actions.SetEnabledRepos(ctx, "o", []int64{123, 1234})
_, err := client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234})
if err != nil {
t.Errorf("Actions.SetEnabledRepos returned error: %v", err)
}

const methodName = "SetEnabledRepos"

testBadOptions(t, methodName, func() (err error) {
_, err = client.Actions.SetEnabledRepos(ctx, "\n", []int64{123, 1234})
_, err = client.Actions.SetEnabledReposInOrg(ctx, "\n", []int64{123, 1234})
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Actions.SetEnabledRepos(ctx, "o", []int64{123, 1234})
return client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234})
})
}

func TestActionsService_AddEnabledRepos(t *testing.T) {
func TestActionsService_AddEnabledReposInOrg(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

Expand All @@ -176,24 +176,24 @@ func TestActionsService_AddEnabledRepos(t *testing.T) {
})

ctx := context.Background()
_, err := client.Actions.AddEnabledRepos(ctx, "o", 123)
_, err := client.Actions.AddEnabledReposInOrg(ctx, "o", 123)
if err != nil {
t.Errorf("Actions.AddEnabledRepos returned error: %v", err)
}

const methodName = "AddEnabledRepos"

testBadOptions(t, methodName, func() (err error) {
_, err = client.Actions.AddEnabledRepos(ctx, "\n", 123)
_, err = client.Actions.AddEnabledReposInOrg(ctx, "\n", 123)
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Actions.AddEnabledRepos(ctx, "o", 123)
return client.Actions.AddEnabledReposInOrg(ctx, "o", 123)
})
}

func TestActionsService_RemoveEnabledRepo(t *testing.T) {
func TestActionsService_RemoveEnabledReposInOrg(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

Expand All @@ -203,20 +203,20 @@ func TestActionsService_RemoveEnabledRepo(t *testing.T) {
})

ctx := context.Background()
_, err := client.Actions.RemoveEnabledRepo(ctx, "o", 123)
_, err := client.Actions.RemoveEnabledReposInOrg(ctx, "o", 123)
if err != nil {
t.Errorf("Actions.RemoveEnabledRepo returned error: %v", err)
}

const methodName = "RemoveEnabledRepo"

testBadOptions(t, methodName, func() (err error) {
_, err = client.Actions.RemoveEnabledRepo(ctx, "\n", 123)
_, err = client.Actions.RemoveEnabledReposInOrg(ctx, "\n", 123)
return err
})

testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
return client.Actions.RemoveEnabledRepo(ctx, "o", 123)
return client.Actions.RemoveEnabledReposInOrg(ctx, "o", 123)
})
}

Expand Down

0 comments on commit dde3ba2

Please sign in to comment.