Loading group_serviceaccounts.go +2 −0 Original line number Diff line number Diff line Loading @@ -37,7 +37,9 @@ type GroupServiceAccount struct { ID int64 `json:"id"` Name string `json:"name"` UserName string `json:"username"` PublicEmail string `json:"public_email"` Email string `json:"email"` UnconfirmedEmail string `json:"unconfirmed_email,omitempty"` } // ListServiceAccountsOptions represents the available ListServiceAccounts() options. Loading group_serviceaccounts_test.go +34 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,40 @@ func TestUpdateServiceAccount(t *testing.T) { assert.Equal(t, want, sa) } func TestUpdateServiceAccount_PublicAndUnconfirmedEmail(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/service_accounts/57", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPatch) fmt.Fprint(w, `{ "id": 57, "username": "service_account_group_345_6018816a18e515214e0c34c2b33523fc", "name": "Updated Service Account", "public_email": "public@example.com", "email": "service_account_group_345_6018816a18e515214e0c34c2b33523fc@noreply.gitlab.example.com", "unconfirmed_email": "custom_email@example.com" }`) }) sa, resp, err := client.Groups.UpdateServiceAccount(1, 57, &UpdateServiceAccountOptions{ Name: new("Updated Service Account"), Email: new("custom_email@example.com"), }) require.NoError(t, err) assert.NotNil(t, resp) want := &GroupServiceAccount{ ID: 57, UserName: "service_account_group_345_6018816a18e515214e0c34c2b33523fc", Name: "Updated Service Account", PublicEmail: "public@example.com", Email: "service_account_group_345_6018816a18e515214e0c34c2b33523fc@noreply.gitlab.example.com", UnconfirmedEmail: "custom_email@example.com", } assert.Equal(t, want, sa) } func TestDeleteServiceAccount(t *testing.T) { t.Parallel() mux, client := setup(t) Loading Loading
group_serviceaccounts.go +2 −0 Original line number Diff line number Diff line Loading @@ -37,7 +37,9 @@ type GroupServiceAccount struct { ID int64 `json:"id"` Name string `json:"name"` UserName string `json:"username"` PublicEmail string `json:"public_email"` Email string `json:"email"` UnconfirmedEmail string `json:"unconfirmed_email,omitempty"` } // ListServiceAccountsOptions represents the available ListServiceAccounts() options. Loading
group_serviceaccounts_test.go +34 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,40 @@ func TestUpdateServiceAccount(t *testing.T) { assert.Equal(t, want, sa) } func TestUpdateServiceAccount_PublicAndUnconfirmedEmail(t *testing.T) { t.Parallel() mux, client := setup(t) mux.HandleFunc("/api/v4/groups/1/service_accounts/57", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPatch) fmt.Fprint(w, `{ "id": 57, "username": "service_account_group_345_6018816a18e515214e0c34c2b33523fc", "name": "Updated Service Account", "public_email": "public@example.com", "email": "service_account_group_345_6018816a18e515214e0c34c2b33523fc@noreply.gitlab.example.com", "unconfirmed_email": "custom_email@example.com" }`) }) sa, resp, err := client.Groups.UpdateServiceAccount(1, 57, &UpdateServiceAccountOptions{ Name: new("Updated Service Account"), Email: new("custom_email@example.com"), }) require.NoError(t, err) assert.NotNil(t, resp) want := &GroupServiceAccount{ ID: 57, UserName: "service_account_group_345_6018816a18e515214e0c34c2b33523fc", Name: "Updated Service Account", PublicEmail: "public@example.com", Email: "service_account_group_345_6018816a18e515214e0c34c2b33523fc@noreply.gitlab.example.com", UnconfirmedEmail: "custom_email@example.com", } assert.Equal(t, want, sa) } func TestDeleteServiceAccount(t *testing.T) { t.Parallel() mux, client := setup(t) Loading