From 7b61a1cc4c5623e6ad025255290c6d8e20e5a3ce Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Thu, 21 Mar 2024 11:40:12 -0400 Subject: [PATCH 1/5] removed oauth client beta flags --- oauth_client.go | 8 +------- oauth_client_integration_test.go | 5 ----- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/oauth_client.go b/oauth_client.go index f71302c4c..df42061a1 100644 --- a/oauth_client.go +++ b/oauth_client.go @@ -89,15 +89,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"` } @@ -150,7 +147,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"` @@ -170,7 +166,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"` @@ -200,7 +195,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"` diff --git a/oauth_client_integration_test.go b/oauth_client_integration_test.go index a2151d68a..767698be3 100644 --- a/oauth_client_integration_test.go +++ b/oauth_client_integration_test.go @@ -177,7 +177,6 @@ func TestOAuthClientsCreate(t *testing.T) { }) t.Run("with projects provided", func(t *testing.T) { - skipUnlessBeta(t) prjTest, prjTestCleanup := createProject(t, client, orgTest) defer prjTestCleanup() @@ -330,7 +329,6 @@ func TestOAuthClientsRead(t *testing.T) { } func TestOAuthClientsReadWithOptions(t *testing.T) { - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() @@ -499,7 +497,6 @@ func TestOAuthClientsCreateOptionsValid(t *testing.T) { } func TestOAuthClientsAddProjects(t *testing.T) { - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() @@ -569,7 +566,6 @@ func TestOAuthClientsAddProjects(t *testing.T) { } func TestOAuthClientsRemoveProjects(t *testing.T) { - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() @@ -633,7 +629,6 @@ func TestOAuthClientsRemoveProjects(t *testing.T) { } func TestOAuthClientsUpdate(t *testing.T) { - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() From c7078915cbc7872dee1e0fae2161783e58a6d5af Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Tue, 9 Apr 2024 16:19:17 -0400 Subject: [PATCH 2/5] test fix --- oauth_client_integration_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/oauth_client_integration_test.go b/oauth_client_integration_test.go index fd090eaab..658a5e124 100644 --- a/oauth_client_integration_test.go +++ b/oauth_client_integration_test.go @@ -179,15 +179,17 @@ func TestOAuthClientsCreate(t *testing.T) { t.Run("with projects provided", func(t *testing.T) { prjTest, prjTestCleanup := createProject(t, client, orgTest) defer prjTestCleanup() - options := OAuthClientCreateOptions{ - Name: String("project-oauth-client"), - Projects: []*Project{prjTest}, + Name: String("project-oauth-client"), + Projects: []*Project{prjTest}, + APIURL: String("https://api.github.com"), + HTTPURL: String("https://github.com"), + OAuthToken: String(githubToken), + ServiceProvider: ServiceProvider(ServiceProviderGithub), } 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) From cfc0d2de146807ce79126eabd6dee8356875899d Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Wed, 10 Apr 2024 09:36:20 -0400 Subject: [PATCH 3/5] test fix --- oauth_client_integration_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/oauth_client_integration_test.go b/oauth_client_integration_test.go index 658a5e124..8369d229a 100644 --- a/oauth_client_integration_test.go +++ b/oauth_client_integration_test.go @@ -190,8 +190,7 @@ func TestOAuthClientsCreate(t *testing.T) { 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], prjTest.Name) assert.Equal(t, ps.Projects[0].ID, prjTest.ID) }) } From c45e461b3b6971e6c3b8232942ebbad628a9ef2c Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Wed, 10 Apr 2024 09:36:49 -0400 Subject: [PATCH 4/5] test fix --- oauth_client_integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauth_client_integration_test.go b/oauth_client_integration_test.go index 8369d229a..ea9255c75 100644 --- a/oauth_client_integration_test.go +++ b/oauth_client_integration_test.go @@ -190,7 +190,7 @@ func TestOAuthClientsCreate(t *testing.T) { ps, err := client.OAuthClients.Create(ctx, orgTest.Name, options) require.NoError(t, err) - assert.Equal(t, ps.Projects[0], prjTest.Name) + assert.Equal(t, ps.Projects[0].Name, prjTest.Name) assert.Equal(t, ps.Projects[0].ID, prjTest.ID) }) } From 5f96a871c8ec73b80c914da7792226681d88d883 Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Wed, 10 Apr 2024 09:53:23 -0400 Subject: [PATCH 5/5] This test is not supported. Only read, add and remove projects. --- oauth_client_integration_test.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/oauth_client_integration_test.go b/oauth_client_integration_test.go index ea9255c75..a405649d1 100644 --- a/oauth_client_integration_test.go +++ b/oauth_client_integration_test.go @@ -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) { - prjTest, prjTestCleanup := createProject(t, client, orgTest) - defer prjTestCleanup() - options := OAuthClientCreateOptions{ - Name: String("project-oauth-client"), - Projects: []*Project{prjTest}, - APIURL: String("https://api.github.com"), - HTTPURL: String("https://github.com"), - OAuthToken: String(githubToken), - ServiceProvider: ServiceProvider(ServiceProviderGithub), - } - - ps, err := client.OAuthClients.Create(ctx, orgTest.Name, options) - require.NoError(t, err) - assert.Equal(t, ps.Projects[0].Name, prjTest.Name) - assert.Equal(t, ps.Projects[0].ID, prjTest.ID) - }) } func TestOAuthClientsCreate_rsaKeyPair(t *testing.T) {