remove unused config field from User
All checks were successful
Lint / golangci-lint (push) Successful in 9m57s
Declarative Tests / test (push) Successful in 28s

This commit is contained in:
Matthew Rich 2024-10-16 11:31:33 -07:00
parent 3f3278b73e
commit 08b2f5301f
2 changed files with 4 additions and 2 deletions

View File

@ -60,7 +60,6 @@ type User struct {
ReadCommand *command.Command `json:"-" yaml:"-"` ReadCommand *command.Command `json:"-" yaml:"-"`
UpdateCommand *command.Command `json:"-" yaml:"-"` UpdateCommand *command.Command `json:"-" yaml:"-"`
DeleteCommand *command.Command `json:"-" yaml:"-"` DeleteCommand *command.Command `json:"-" yaml:"-"`
config data.ConfigurationValueGetter
Resources data.ResourceMapper `json:"-" yaml:"-"` Resources data.ResourceMapper `json:"-" yaml:"-"`
} }
@ -96,8 +95,9 @@ func FindSystemUserType() UserType {
func (u *User) Init(uri data.URIParser) error { func (u *User) Init(uri data.URIParser) error {
if uri == nil { if uri == nil {
uri = folio.URI(u.URI()).Parse() uri = folio.URI(u.URI()).Parse()
} } else {
u.Name = uri.URL().Hostname() u.Name = uri.URL().Hostname()
}
u.UID = LookupUIDString(uri.URL().Hostname()) u.UID = LookupUIDString(uri.URL().Hostname())
u.CreateCommand, u.ReadCommand, u.UpdateCommand, u.DeleteCommand = u.UserType.NewCRUD() u.CreateCommand, u.ReadCommand, u.UpdateCommand, u.DeleteCommand = u.UserType.NewCRUD()
return u.SetParsedURI(uri) return u.SetParsedURI(uri)

View File

@ -94,7 +94,9 @@ func TestSystemUser(t *testing.T) {
return nil, fmt.Errorf("%w: %s", data.ErrUnknownConfigurationKey, key) return nil, fmt.Errorf("%w: %s", data.ErrUnknownConfigurationKey, key)
})) }))
assert.Nil(t, u.Init(nil))
u.ResolveId(context.Background()) u.ResolveId(context.Background())
assert.Equal(t, "bar", u.Name) assert.Equal(t, "bar", u.Name)
} }