diff options
Diffstat (limited to 'cmd/gitlab-shell-authorized-keys-check/command')
-rw-r--r-- | cmd/gitlab-shell-authorized-keys-check/command/command.go | 8 | ||||
-rw-r--r-- | cmd/gitlab-shell-authorized-keys-check/command/command_test.go | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/cmd/gitlab-shell-authorized-keys-check/command/command.go b/cmd/gitlab-shell-authorized-keys-check/command/command.go index 3db8605..8cf309b 100644 --- a/cmd/gitlab-shell-authorized-keys-check/command/command.go +++ b/cmd/gitlab-shell-authorized-keys-check/command/command.go @@ -7,12 +7,10 @@ import ( "gitlab.com/gitlab-org/gitlab-shell/internal/command/readwriter" "gitlab.com/gitlab-org/gitlab-shell/internal/command/shared/disallowedcommand" "gitlab.com/gitlab-org/gitlab-shell/internal/config" - "gitlab.com/gitlab-org/gitlab-shell/internal/executable" - "gitlab.com/gitlab-org/gitlab-shell/internal/sshenv" ) -func New(e *executable.Executable, arguments []string, env sshenv.Env, config *config.Config, readWriter *readwriter.ReadWriter) (command.Command, error) { - args, err := Parse(e, arguments, env) +func New(arguments []string, config *config.Config, readWriter *readwriter.ReadWriter) (command.Command, error) { + args, err := Parse(arguments) if err != nil { return nil, err } @@ -24,7 +22,7 @@ func New(e *executable.Executable, arguments []string, env sshenv.Env, config *c return nil, disallowedcommand.Error } -func Parse(e *executable.Executable, arguments []string, env sshenv.Env) (*commandargs.AuthorizedKeys, error) { +func Parse(arguments []string) (*commandargs.AuthorizedKeys, error) { args := &commandargs.AuthorizedKeys{Arguments: arguments} if err := args.Parse(); err != nil { diff --git a/cmd/gitlab-shell-authorized-keys-check/command/command_test.go b/cmd/gitlab-shell-authorized-keys-check/command/command_test.go index 5c5419e..3343e1c 100644 --- a/cmd/gitlab-shell-authorized-keys-check/command/command_test.go +++ b/cmd/gitlab-shell-authorized-keys-check/command/command_test.go @@ -37,7 +37,7 @@ func TestNew(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - command, err := command.New(tc.executable, tc.arguments, tc.env, tc.config, nil) + command, err := command.New(tc.arguments, tc.config, nil) require.NoError(t, err) require.IsType(t, tc.expectedType, command) @@ -64,7 +64,7 @@ func TestParseSuccess(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - result, err := command.Parse(tc.executable, tc.arguments, tc.env) + result, err := command.Parse(tc.arguments) if !tc.expectError { require.NoError(t, err) @@ -112,7 +112,7 @@ func TestParseFailure(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - _, err := command.Parse(tc.executable, tc.arguments, tc.env) + _, err := command.Parse(tc.arguments) require.EqualError(t, err, tc.expectedError) }) |