Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove OAuth Client Beta Flag #873

Merged
merged 7 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions oauth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,12 @@ type OAuthClient struct {
Secret string `jsonapi:"attr,secret"`
ServiceProvider ServiceProviderType `jsonapi:"attr,service-provider"`
ServiceProviderName string `jsonapi:"attr,service-provider-display-name"`
// **Note: This field is still in BETA and subject to change.**
OrganizationScoped *bool `jsonapi:"attr,organization-scoped"`
OrganizationScoped *bool `jsonapi:"attr,organization-scoped"`

// Relations
Organization *Organization `jsonapi:"relation,organization"`
OAuthTokens []*OAuthToken `jsonapi:"relation,oauth-tokens"`
AgentPool *AgentPool `jsonapi:"relation,agent-pool"`

// **Note: This field is still in BETA and subject to change.**
// The projects to which the oauth client applies.
Projects []*Project `jsonapi:"relation,projects"`
}
Expand Down Expand Up @@ -151,7 +148,6 @@ type OAuthClientCreateOptions struct {
// Optional: The token string you were given by your VCS provider.
OAuthToken *string `jsonapi:"attr,oauth-token-string,omitempty"`

// **Note: This field is still in BETA and subject to change.**
// Optional: The initial list of projects for which the oauth client should be associated with.
Projects []*Project `jsonapi:"relation,projects,omitempty"`

Expand All @@ -171,7 +167,6 @@ type OAuthClientCreateOptions struct {
// Optional: AgentPool to associate the VCS Provider with, for PrivateVCS support
AgentPool *AgentPool `jsonapi:"relation,agent-pool,omitempty"`

// **Note: This field is still in BETA and subject to change.**
// Optional: Whether the OAuthClient is available to all workspaces in the organization.
// True if the oauth client is organization scoped, false otherwise.
OrganizationScoped *bool `jsonapi:"attr,organization-scoped,omitempty"`
Expand Down Expand Up @@ -201,7 +196,6 @@ type OAuthClientUpdateOptions struct {
// Optional: The token string you were given by your VCS provider.
OAuthToken *string `jsonapi:"attr,oauth-token-string,omitempty"`

// **Note: This field is still in BETA and subject to change.**
// Optional: Whether the OAuthClient is available to all workspaces in the organization.
// True if the oauth client is organization scoped, false otherwise.
OrganizationScoped *bool `jsonapi:"attr,organization-scoped,omitempty"`
Expand Down
22 changes: 0 additions & 22 deletions oauth_client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,6 @@ func TestOAuthClientsCreate(t *testing.T) {
_, err := client.OAuthClients.Create(ctx, orgTest.Name, options)
assert.Equal(t, err, ErrRequiredServiceProvider)
})

t.Run("with projects provided", func(t *testing.T) {
skipUnlessBeta(t)
prjTest, prjTestCleanup := createProject(t, client, orgTest)
defer prjTestCleanup()

options := OAuthClientCreateOptions{
Name: String("project-oauth-client"),
Projects: []*Project{prjTest},
}

ps, err := client.OAuthClients.Create(ctx, orgTest.Name, options)
require.NoError(t, err)

assert.Equal(t, ps.Name, *options.Name)
assert.Equal(t, len(ps.Projects), 1)
assert.Equal(t, ps.Projects[0].ID, prjTest.ID)
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't tell but does this test already exist somewhere else and that's why we're deleting it completely and not just line 180?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this test actually doesn't make sense and won't pass since the projects attribute was added to the add projects and remove projects api only.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

}

func TestOAuthClientsCreate_rsaKeyPair(t *testing.T) {
Expand Down Expand Up @@ -330,7 +312,6 @@ func TestOAuthClientsRead(t *testing.T) {
}

func TestOAuthClientsReadWithOptions(t *testing.T) {
skipUnlessBeta(t)
client := testClient(t)
ctx := context.Background()

Expand Down Expand Up @@ -499,7 +480,6 @@ func TestOAuthClientsCreateOptionsValid(t *testing.T) {
}

func TestOAuthClientsAddProjects(t *testing.T) {
skipUnlessBeta(t)
client := testClient(t)
ctx := context.Background()

Expand Down Expand Up @@ -569,7 +549,6 @@ func TestOAuthClientsAddProjects(t *testing.T) {
}

func TestOAuthClientsRemoveProjects(t *testing.T) {
skipUnlessBeta(t)
client := testClient(t)
ctx := context.Background()

Expand Down Expand Up @@ -633,7 +612,6 @@ func TestOAuthClientsRemoveProjects(t *testing.T) {
}

func TestOAuthClientsUpdate(t *testing.T) {
skipUnlessBeta(t)
client := testClient(t)
ctx := context.Background()

Expand Down
Loading