From 08b2f5301f037ba7a45291f19b06ee911293d83e Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Wed, 16 Oct 2024 11:31:33 -0700 Subject: [PATCH] remove unused config field from User --- internal/resource/user.go | 4 ++-- internal/resource/user_test.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/resource/user.go b/internal/resource/user.go index 1040787..35ee6e7 100644 --- a/internal/resource/user.go +++ b/internal/resource/user.go @@ -60,7 +60,6 @@ type User struct { ReadCommand *command.Command `json:"-" yaml:"-"` UpdateCommand *command.Command `json:"-" yaml:"-"` DeleteCommand *command.Command `json:"-" yaml:"-"` - config data.ConfigurationValueGetter Resources data.ResourceMapper `json:"-" yaml:"-"` } @@ -96,8 +95,9 @@ func FindSystemUserType() UserType { func (u *User) Init(uri data.URIParser) error { if uri == nil { uri = folio.URI(u.URI()).Parse() + } else { + u.Name = uri.URL().Hostname() } - u.Name = uri.URL().Hostname() u.UID = LookupUIDString(uri.URL().Hostname()) u.CreateCommand, u.ReadCommand, u.UpdateCommand, u.DeleteCommand = u.UserType.NewCRUD() return u.SetParsedURI(uri) diff --git a/internal/resource/user_test.go b/internal/resource/user_test.go index 52da42d..d66b875 100644 --- a/internal/resource/user_test.go +++ b/internal/resource/user_test.go @@ -94,7 +94,9 @@ func TestSystemUser(t *testing.T) { return nil, fmt.Errorf("%w: %s", data.ErrUnknownConfigurationKey, key) })) + assert.Nil(t, u.Init(nil)) u.ResolveId(context.Background()) + assert.Equal(t, "bar", u.Name) }