summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-07-29 15:59:23 +0800
committerPatrick Bajao <ebajao@gitlab.com>2019-07-31 12:03:43 +0800
commit592823d5e25006331b361b36cc61df7802fc1938 (patch)
treee5dfda205795e9526eb94866de65073cd6a83915
parent3b0176df497263323da2fae793a79b568502e6db (diff)
downloadgitlab-shell-592823d5e25006331b361b36cc61df7802fc1938.tar.gz
Rename CommandArgs to Shell
Other functions are still expecting for `CommandArgs` instead of `Shell`. They should be expecting `commandargs.Shell` now since it has been renamed.
-rw-r--r--go/internal/command/discover/discover.go2
-rw-r--r--go/internal/command/discover/discover_test.go18
-rw-r--r--go/internal/command/lfsauthenticate/lfsauthenticate.go2
-rw-r--r--go/internal/command/lfsauthenticate/lfsauthenticate_test.go10
-rw-r--r--go/internal/command/receivepack/customaction_test.go2
-rw-r--r--go/internal/command/receivepack/gitalycall_test.go2
-rw-r--r--go/internal/command/receivepack/receivepack.go2
-rw-r--r--go/internal/command/receivepack/receivepack_test.go2
-rw-r--r--go/internal/command/shared/accessverifier/accessverifier.go2
-rw-r--r--go/internal/command/shared/accessverifier/accessverifier_test.go4
-rw-r--r--go/internal/command/twofactorrecover/twofactorrecover.go2
-rw-r--r--go/internal/command/twofactorrecover/twofactorrecover_test.go14
-rw-r--r--go/internal/command/uploadarchive/gitalycall_test.go2
-rw-r--r--go/internal/command/uploadarchive/uploadarchive.go2
-rw-r--r--go/internal/command/uploadarchive/uploadarchive_test.go2
-rw-r--r--go/internal/command/uploadpack/gitalycall_test.go2
-rw-r--r--go/internal/command/uploadpack/uploadpack.go2
-rw-r--r--go/internal/command/uploadpack/uploadpack_test.go2
-rw-r--r--go/internal/gitlabnet/accessverifier/client.go4
-rw-r--r--go/internal/gitlabnet/accessverifier/client_test.go10
-rw-r--r--go/internal/gitlabnet/discover/client.go2
-rw-r--r--go/internal/gitlabnet/lfsauthenticate/client.go4
-rw-r--r--go/internal/gitlabnet/lfsauthenticate/client_test.go10
-rw-r--r--go/internal/gitlabnet/twofactorrecover/client.go4
-rw-r--r--go/internal/gitlabnet/twofactorrecover/client_test.go8
25 files changed, 58 insertions, 58 deletions
diff --git a/go/internal/command/discover/discover.go b/go/internal/command/discover/discover.go
index 7d4ad2b..de94b56 100644
--- a/go/internal/command/discover/discover.go
+++ b/go/internal/command/discover/discover.go
@@ -11,7 +11,7 @@ import (
type Command struct {
Config *config.Config
- Args *commandargs.CommandArgs
+ Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
diff --git a/go/internal/command/discover/discover_test.go b/go/internal/command/discover/discover_test.go
index 284610a..7e052f7 100644
--- a/go/internal/command/discover/discover_test.go
+++ b/go/internal/command/discover/discover_test.go
@@ -49,27 +49,27 @@ func TestExecute(t *testing.T) {
testCases := []struct {
desc string
- arguments *commandargs.CommandArgs
+ arguments *commandargs.Shell
expectedOutput string
}{
{
desc: "With a known username",
- arguments: &commandargs.CommandArgs{GitlabUsername: "alex-doe"},
+ arguments: &commandargs.Shell{GitlabUsername: "alex-doe"},
expectedOutput: "Welcome to GitLab, @alex-doe!\n",
},
{
desc: "With a known key id",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "1"},
+ arguments: &commandargs.Shell{GitlabKeyId: "1"},
expectedOutput: "Welcome to GitLab, @alex-doe!\n",
},
{
desc: "With an unknown key",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "-1"},
+ arguments: &commandargs.Shell{GitlabKeyId: "-1"},
expectedOutput: "Welcome to GitLab, Anonymous!\n",
},
{
desc: "With an unknown username",
- arguments: &commandargs.CommandArgs{GitlabUsername: "unknown"},
+ arguments: &commandargs.Shell{GitlabUsername: "unknown"},
expectedOutput: "Welcome to GitLab, Anonymous!\n",
},
}
@@ -97,22 +97,22 @@ func TestFailingExecute(t *testing.T) {
testCases := []struct {
desc string
- arguments *commandargs.CommandArgs
+ arguments *commandargs.Shell
expectedError string
}{
{
desc: "With missing arguments",
- arguments: &commandargs.CommandArgs{},
+ arguments: &commandargs.Shell{},
expectedError: "Failed to get username: who='' is invalid",
},
{
desc: "When the API returns an error",
- arguments: &commandargs.CommandArgs{GitlabUsername: "broken_message"},
+ arguments: &commandargs.Shell{GitlabUsername: "broken_message"},
expectedError: "Failed to get username: Forbidden!",
},
{
desc: "When the API fails",
- arguments: &commandargs.CommandArgs{GitlabUsername: "broken"},
+ arguments: &commandargs.Shell{GitlabUsername: "broken"},
expectedError: "Failed to get username: Internal API error (500)",
},
}
diff --git a/go/internal/command/lfsauthenticate/lfsauthenticate.go b/go/internal/command/lfsauthenticate/lfsauthenticate.go
index c1dc45f..bff5e7f 100644
--- a/go/internal/command/lfsauthenticate/lfsauthenticate.go
+++ b/go/internal/command/lfsauthenticate/lfsauthenticate.go
@@ -20,7 +20,7 @@ const (
type Command struct {
Config *config.Config
- Args *commandargs.CommandArgs
+ Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
diff --git a/go/internal/command/lfsauthenticate/lfsauthenticate_test.go b/go/internal/command/lfsauthenticate/lfsauthenticate_test.go
index 30da94b..a6836a8 100644
--- a/go/internal/command/lfsauthenticate/lfsauthenticate_test.go
+++ b/go/internal/command/lfsauthenticate/lfsauthenticate_test.go
@@ -25,22 +25,22 @@ func TestFailedRequests(t *testing.T) {
testCases := []struct {
desc string
- arguments *commandargs.CommandArgs
+ arguments *commandargs.Shell
expectedOutput string
}{
{
desc: "With missing arguments",
- arguments: &commandargs.CommandArgs{},
+ arguments: &commandargs.Shell{},
expectedOutput: "> GitLab: Disallowed command",
},
{
desc: "With disallowed command",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "1", SshArgs: []string{"git-lfs-authenticate", "group/repo", "unknown"}},
+ arguments: &commandargs.Shell{GitlabKeyId: "1", SshArgs: []string{"git-lfs-authenticate", "group/repo", "unknown"}},
expectedOutput: "> GitLab: Disallowed command",
},
{
desc: "With disallowed user",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "disallowed", SshArgs: []string{"git-lfs-authenticate", "group/repo", "download"}},
+ arguments: &commandargs.Shell{GitlabKeyId: "disallowed", SshArgs: []string{"git-lfs-authenticate", "group/repo", "download"}},
expectedOutput: "Disallowed by API call",
},
}
@@ -140,7 +140,7 @@ func TestLfsAuthenticateRequests(t *testing.T) {
output := &bytes.Buffer{}
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabUsername: tc.username, SshArgs: []string{"git-lfs-authenticate", "group/repo", "upload"}},
+ Args: &commandargs.Shell{GitlabUsername: tc.username, SshArgs: []string{"git-lfs-authenticate", "group/repo", "upload"}},
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output},
}
diff --git a/go/internal/command/receivepack/customaction_test.go b/go/internal/command/receivepack/customaction_test.go
index 80e849c..bd4991d 100644
--- a/go/internal/command/receivepack/customaction_test.go
+++ b/go/internal/command/receivepack/customaction_test.go
@@ -92,7 +92,7 @@ func TestCustomReceivePack(t *testing.T) {
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabKeyId: keyId, CommandType: commandargs.ReceivePack, SshArgs: []string{"git-receive-pack", repo}},
+ Args: &commandargs.Shell{GitlabKeyId: keyId, CommandType: commandargs.ReceivePack, SshArgs: []string{"git-receive-pack", repo}},
ReadWriter: &readwriter.ReadWriter{ErrOut: errBuf, Out: outBuf, In: input},
}
diff --git a/go/internal/command/receivepack/gitalycall_test.go b/go/internal/command/receivepack/gitalycall_test.go
index 0914be6..eac9218 100644
--- a/go/internal/command/receivepack/gitalycall_test.go
+++ b/go/internal/command/receivepack/gitalycall_test.go
@@ -29,7 +29,7 @@ func TestReceivePack(t *testing.T) {
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabKeyId: userId, CommandType: commandargs.ReceivePack, SshArgs: []string{"git-receive-pack", repo}},
+ Args: &commandargs.Shell{GitlabKeyId: userId, CommandType: commandargs.ReceivePack, SshArgs: []string{"git-receive-pack", repo}},
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output, In: input},
}
diff --git a/go/internal/command/receivepack/receivepack.go b/go/internal/command/receivepack/receivepack.go
index d6b788c..eb0b2fe 100644
--- a/go/internal/command/receivepack/receivepack.go
+++ b/go/internal/command/receivepack/receivepack.go
@@ -10,7 +10,7 @@ import (
type Command struct {
Config *config.Config
- Args *commandargs.CommandArgs
+ Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
diff --git a/go/internal/command/receivepack/receivepack_test.go b/go/internal/command/receivepack/receivepack_test.go
index e5263f5..a45d054 100644
--- a/go/internal/command/receivepack/receivepack_test.go
+++ b/go/internal/command/receivepack/receivepack_test.go
@@ -23,7 +23,7 @@ func TestForbiddenAccess(t *testing.T) {
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabKeyId: "disallowed", SshArgs: []string{"git-receive-pack", "group/repo"}},
+ Args: &commandargs.Shell{GitlabKeyId: "disallowed", SshArgs: []string{"git-receive-pack", "group/repo"}},
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output, In: input},
}
diff --git a/go/internal/command/shared/accessverifier/accessverifier.go b/go/internal/command/shared/accessverifier/accessverifier.go
index 6d13789..fc6fa17 100644
--- a/go/internal/command/shared/accessverifier/accessverifier.go
+++ b/go/internal/command/shared/accessverifier/accessverifier.go
@@ -14,7 +14,7 @@ type Response = accessverifier.Response
type Command struct {
Config *config.Config
- Args *commandargs.CommandArgs
+ Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
diff --git a/go/internal/command/shared/accessverifier/accessverifier_test.go b/go/internal/command/shared/accessverifier/accessverifier_test.go
index dd95ded..c19ed37 100644
--- a/go/internal/command/shared/accessverifier/accessverifier_test.go
+++ b/go/internal/command/shared/accessverifier/accessverifier_test.go
@@ -64,7 +64,7 @@ func TestMissingUser(t *testing.T) {
cmd, _, _, cleanup := setup(t)
defer cleanup()
- cmd.Args = &commandargs.CommandArgs{GitlabKeyId: "2"}
+ cmd.Args = &commandargs.Shell{GitlabKeyId: "2"}
_, err := cmd.Verify(action, repo)
require.Equal(t, "missing user", err.Error())
@@ -74,7 +74,7 @@ func TestConsoleMessages(t *testing.T) {
cmd, errBuf, outBuf, cleanup := setup(t)
defer cleanup()
- cmd.Args = &commandargs.CommandArgs{GitlabKeyId: "1"}
+ cmd.Args = &commandargs.Shell{GitlabKeyId: "1"}
cmd.Verify(action, repo)
require.Equal(t, "> GitLab: console\n> GitLab: message\n", errBuf.String())
diff --git a/go/internal/command/twofactorrecover/twofactorrecover.go b/go/internal/command/twofactorrecover/twofactorrecover.go
index faa35db..c68080a 100644
--- a/go/internal/command/twofactorrecover/twofactorrecover.go
+++ b/go/internal/command/twofactorrecover/twofactorrecover.go
@@ -12,7 +12,7 @@ import (
type Command struct {
Config *config.Config
- Args *commandargs.CommandArgs
+ Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
diff --git a/go/internal/command/twofactorrecover/twofactorrecover_test.go b/go/internal/command/twofactorrecover/twofactorrecover_test.go
index 6238e0d..291d499 100644
--- a/go/internal/command/twofactorrecover/twofactorrecover_test.go
+++ b/go/internal/command/twofactorrecover/twofactorrecover_test.go
@@ -69,13 +69,13 @@ func TestExecute(t *testing.T) {
testCases := []struct {
desc string
- arguments *commandargs.CommandArgs
+ arguments *commandargs.Shell
answer string
expectedOutput string
}{
{
desc: "With a known key id",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "1"},
+ arguments: &commandargs.Shell{GitlabKeyId: "1"},
answer: "yes\n",
expectedOutput: question +
"Your two-factor authentication recovery codes are:\n\nrecovery\ncodes\n\n" +
@@ -85,31 +85,31 @@ func TestExecute(t *testing.T) {
},
{
desc: "With bad response",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "-1"},
+ arguments: &commandargs.Shell{GitlabKeyId: "-1"},
answer: "yes\n",
expectedOutput: question + errorHeader + "Parsing failed\n",
},
{
desc: "With API returns an error",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "forbidden"},
+ arguments: &commandargs.Shell{GitlabKeyId: "forbidden"},
answer: "yes\n",
expectedOutput: question + errorHeader + "Forbidden!\n",
},
{
desc: "With API fails",
- arguments: &commandargs.CommandArgs{GitlabKeyId: "broken"},
+ arguments: &commandargs.Shell{GitlabKeyId: "broken"},
answer: "yes\n",
expectedOutput: question + errorHeader + "Internal API error (500)\n",
},
{
desc: "With missing arguments",
- arguments: &commandargs.CommandArgs{},
+ arguments: &commandargs.Shell{},
answer: "yes\n",
expectedOutput: question + errorHeader + "who='' is invalid\n",
},
{
desc: "With negative answer",
- arguments: &commandargs.CommandArgs{},
+ arguments: &commandargs.Shell{},
answer: "no\n",
expectedOutput: question +
"New recovery codes have *not* been generated. Existing codes will remain valid.\n",
diff --git a/go/internal/command/uploadarchive/gitalycall_test.go b/go/internal/command/uploadarchive/gitalycall_test.go
index 78953a7..5eb2eae 100644
--- a/go/internal/command/uploadarchive/gitalycall_test.go
+++ b/go/internal/command/uploadarchive/gitalycall_test.go
@@ -29,7 +29,7 @@ func TestUploadPack(t *testing.T) {
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabKeyId: userId, CommandType: commandargs.UploadArchive, SshArgs: []string{"git-upload-archive", repo}},
+ Args: &commandargs.Shell{GitlabKeyId: userId, CommandType: commandargs.UploadArchive, SshArgs: []string{"git-upload-archive", repo}},
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output, In: input},
}
diff --git a/go/internal/command/uploadarchive/uploadarchive.go b/go/internal/command/uploadarchive/uploadarchive.go
index 93a52c0..2846455 100644
--- a/go/internal/command/uploadarchive/uploadarchive.go
+++ b/go/internal/command/uploadarchive/uploadarchive.go
@@ -10,7 +10,7 @@ import (
type Command struct {
Config *config.Config
- Args *commandargs.CommandArgs
+ Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
diff --git a/go/internal/command/uploadarchive/uploadarchive_test.go b/go/internal/command/uploadarchive/uploadarchive_test.go
index 369bee7..4cd6832 100644
--- a/go/internal/command/uploadarchive/uploadarchive_test.go
+++ b/go/internal/command/uploadarchive/uploadarchive_test.go
@@ -22,7 +22,7 @@ func TestForbiddenAccess(t *testing.T) {
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabKeyId: "disallowed", SshArgs: []string{"git-upload-archive", "group/repo"}},
+ Args: &commandargs.Shell{GitlabKeyId: "disallowed", SshArgs: []string{"git-upload-archive", "group/repo"}},
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output},
}
diff --git a/go/internal/command/uploadpack/gitalycall_test.go b/go/internal/command/uploadpack/gitalycall_test.go
index 2097964..eb18aa8 100644
--- a/go/internal/command/uploadpack/gitalycall_test.go
+++ b/go/internal/command/uploadpack/gitalycall_test.go
@@ -29,7 +29,7 @@ func TestUploadPack(t *testing.T) {
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabKeyId: userId, CommandType: commandargs.UploadPack, SshArgs: []string{"git-upload-pack", repo}},
+ Args: &commandargs.Shell{GitlabKeyId: userId, CommandType: commandargs.UploadPack, SshArgs: []string{"git-upload-pack", repo}},
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output, In: input},
}
diff --git a/go/internal/command/uploadpack/uploadpack.go b/go/internal/command/uploadpack/uploadpack.go
index cff198d..4b08bf2 100644
--- a/go/internal/command/uploadpack/uploadpack.go
+++ b/go/internal/command/uploadpack/uploadpack.go
@@ -10,7 +10,7 @@ import (
type Command struct {
Config *config.Config
- Args *commandargs.CommandArgs
+ Args *commandargs.Shell
ReadWriter *readwriter.ReadWriter
}
diff --git a/go/internal/command/uploadpack/uploadpack_test.go b/go/internal/command/uploadpack/uploadpack_test.go
index a06ba24..27a0786 100644
--- a/go/internal/command/uploadpack/uploadpack_test.go
+++ b/go/internal/command/uploadpack/uploadpack_test.go
@@ -22,7 +22,7 @@ func TestForbiddenAccess(t *testing.T) {
cmd := &Command{
Config: &config.Config{GitlabUrl: url},
- Args: &commandargs.CommandArgs{GitlabKeyId: "disallowed", SshArgs: []string{"git-upload-pack", "group/repo"}},
+ Args: &commandargs.Shell{GitlabKeyId: "disallowed", SshArgs: []string{"git-upload-pack", "group/repo"}},
ReadWriter: &readwriter.ReadWriter{ErrOut: output, Out: output},
}
diff --git a/go/internal/gitlabnet/accessverifier/client.go b/go/internal/gitlabnet/accessverifier/client.go
index d87c4ad..92a7434 100644
--- a/go/internal/gitlabnet/accessverifier/client.go
+++ b/go/internal/gitlabnet/accessverifier/client.go
@@ -71,7 +71,7 @@ func NewClient(config *config.Config) (*Client, error) {
return &Client{client: client}, nil
}
-func (c *Client) Verify(args *commandargs.CommandArgs, action commandargs.CommandType, repo string) (*Response, error) {
+func (c *Client) Verify(args *commandargs.Shell, action commandargs.CommandType, repo string) (*Response, error) {
request := &Request{Action: action, Repo: repo, Protocol: protocol, Changes: anyChanges}
if args.GitlabUsername != "" {
@@ -89,7 +89,7 @@ func (c *Client) Verify(args *commandargs.CommandArgs, action commandargs.Comman
return parse(response, args)
}
-func parse(hr *http.Response, args *commandargs.CommandArgs) (*Response, error) {
+func parse(hr *http.Response, args *commandargs.Shell) (*Response, error) {
response := &Response{}
if err := gitlabnet.ParseJSON(hr, response); err != nil {
return nil, err
diff --git a/go/internal/gitlabnet/accessverifier/client_test.go b/go/internal/gitlabnet/accessverifier/client_test.go
index 31175ae..f534185 100644
--- a/go/internal/gitlabnet/accessverifier/client_test.go
+++ b/go/internal/gitlabnet/accessverifier/client_test.go
@@ -57,16 +57,16 @@ func TestSuccessfulResponses(t *testing.T) {
testCases := []struct {
desc string
- args *commandargs.CommandArgs
+ args *commandargs.Shell
who string
}{
{
desc: "Provide key id within the request",
- args: &commandargs.CommandArgs{GitlabKeyId: "1"},
+ args: &commandargs.Shell{GitlabKeyId: "1"},
who: "key-1",
}, {
desc: "Provide username within the request",
- args: &commandargs.CommandArgs{GitlabUsername: "first"},
+ args: &commandargs.Shell{GitlabUsername: "first"},
who: "user-1",
},
}
@@ -86,7 +86,7 @@ func TestGetCustomAction(t *testing.T) {
client, cleanup := setup(t)
defer cleanup()
- args := &commandargs.CommandArgs{GitlabUsername: "custom"}
+ args := &commandargs.Shell{GitlabUsername: "custom"}
result, err := client.Verify(args, action, repo)
require.NoError(t, err)
@@ -134,7 +134,7 @@ func TestErrorResponses(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- args := &commandargs.CommandArgs{GitlabKeyId: tc.fakeId}
+ args := &commandargs.Shell{GitlabKeyId: tc.fakeId}
resp, err := client.Verify(args, action, repo)
require.EqualError(t, err, tc.expectedError)
diff --git a/go/internal/gitlabnet/discover/client.go b/go/internal/gitlabnet/discover/client.go
index 675670d..46ab2de 100644
--- a/go/internal/gitlabnet/discover/client.go
+++ b/go/internal/gitlabnet/discover/client.go
@@ -30,7 +30,7 @@ func NewClient(config *config.Config) (*Client, error) {
return &Client{config: config, client: client}, nil
}
-func (c *Client) GetByCommandArgs(args *commandargs.CommandArgs) (*Response, error) {
+func (c *Client) GetByCommandArgs(args *commandargs.Shell) (*Response, error) {
params := url.Values{}
if args.GitlabUsername != "" {
params.Add("username", args.GitlabUsername)
diff --git a/go/internal/gitlabnet/lfsauthenticate/client.go b/go/internal/gitlabnet/lfsauthenticate/client.go
index 2a7cb03..51cb7a4 100644
--- a/go/internal/gitlabnet/lfsauthenticate/client.go
+++ b/go/internal/gitlabnet/lfsauthenticate/client.go
@@ -13,7 +13,7 @@ import (
type Client struct {
config *config.Config
client *gitlabnet.GitlabClient
- args *commandargs.CommandArgs
+ args *commandargs.Shell
}
type Request struct {
@@ -30,7 +30,7 @@ type Response struct {
ExpiresIn int `json:"expires_in"`
}
-func NewClient(config *config.Config, args *commandargs.CommandArgs) (*Client, error) {
+func NewClient(config *config.Config, args *commandargs.Shell) (*Client, error) {
client, err := gitlabnet.GetClient(config)
if err != nil {
return nil, fmt.Errorf("Error creating http client: %v", err)
diff --git a/go/internal/gitlabnet/lfsauthenticate/client_test.go b/go/internal/gitlabnet/lfsauthenticate/client_test.go
index 7fd7aca..07484a7 100644
--- a/go/internal/gitlabnet/lfsauthenticate/client_test.go
+++ b/go/internal/gitlabnet/lfsauthenticate/client_test.go
@@ -59,22 +59,22 @@ func TestFailedRequests(t *testing.T) {
testCases := []struct {
desc string
- args *commandargs.CommandArgs
+ args *commandargs.Shell
expectedOutput string
}{
{
desc: "With bad response",
- args: &commandargs.CommandArgs{GitlabKeyId: "-1", CommandType: commandargs.UploadPack},
+ args: &commandargs.Shell{GitlabKeyId: "-1", CommandType: commandargs.UploadPack},
expectedOutput: "Parsing failed",
},
{
desc: "With API returns an error",
- args: &commandargs.CommandArgs{GitlabKeyId: "forbidden", CommandType: commandargs.UploadPack},
+ args: &commandargs.Shell{GitlabKeyId: "forbidden", CommandType: commandargs.UploadPack},
expectedOutput: "Internal API error (403)",
},
{
desc: "With API fails",
- args: &commandargs.CommandArgs{GitlabKeyId: "broken", CommandType: commandargs.UploadPack},
+ args: &commandargs.Shell{GitlabKeyId: "broken", CommandType: commandargs.UploadPack},
expectedOutput: "Internal API error (500)",
},
}
@@ -99,7 +99,7 @@ func TestSuccessfulRequests(t *testing.T) {
url, cleanup := testserver.StartHttpServer(t, requests)
defer cleanup()
- args := &commandargs.CommandArgs{GitlabKeyId: keyId, CommandType: commandargs.LfsAuthenticate}
+ args := &commandargs.Shell{GitlabKeyId: keyId, CommandType: commandargs.LfsAuthenticate}
client, err := NewClient(&config.Config{GitlabUrl: url}, args)
require.NoError(t, err)
diff --git a/go/internal/gitlabnet/twofactorrecover/client.go b/go/internal/gitlabnet/twofactorrecover/client.go
index f90a85c..37067db 100644
--- a/go/internal/gitlabnet/twofactorrecover/client.go
+++ b/go/internal/gitlabnet/twofactorrecover/client.go
@@ -36,7 +36,7 @@ func NewClient(config *config.Config) (*Client, error) {
return &Client{config: config, client: client}, nil
}
-func (c *Client) GetRecoveryCodes(args *commandargs.CommandArgs) ([]string, error) {
+func (c *Client) GetRecoveryCodes(args *commandargs.Shell) ([]string, error) {
requestBody, err := c.getRequestBody(args)
if err != nil {
@@ -65,7 +65,7 @@ func parse(hr *http.Response) ([]string, error) {
return response.RecoveryCodes, nil
}
-func (c *Client) getRequestBody(args *commandargs.CommandArgs) (*RequestBody, error) {
+func (c *Client) getRequestBody(args *commandargs.Shell) (*RequestBody, error) {
client, err := discover.NewClient(c.config)
if err != nil {
diff --git a/go/internal/gitlabnet/twofactorrecover/client_test.go b/go/internal/gitlabnet/twofactorrecover/client_test.go
index 4b15ac5..a560fb1 100644
--- a/go/internal/gitlabnet/twofactorrecover/client_test.go
+++ b/go/internal/gitlabnet/twofactorrecover/client_test.go
@@ -85,7 +85,7 @@ func TestGetRecoveryCodesByKeyId(t *testing.T) {
client, cleanup := setup(t)
defer cleanup()
- args := &commandargs.CommandArgs{GitlabKeyId: "0"}
+ args := &commandargs.Shell{GitlabKeyId: "0"}
result, err := client.GetRecoveryCodes(args)
assert.NoError(t, err)
assert.Equal(t, []string{"recovery 1", "codes 1"}, result)
@@ -95,7 +95,7 @@ func TestGetRecoveryCodesByUsername(t *testing.T) {
client, cleanup := setup(t)
defer cleanup()
- args := &commandargs.CommandArgs{GitlabUsername: "jane-doe"}
+ args := &commandargs.Shell{GitlabUsername: "jane-doe"}
result, err := client.GetRecoveryCodes(args)
assert.NoError(t, err)
assert.Equal(t, []string{"recovery 2", "codes 2"}, result)
@@ -105,7 +105,7 @@ func TestMissingUser(t *testing.T) {
client, cleanup := setup(t)
defer cleanup()
- args := &commandargs.CommandArgs{GitlabKeyId: "1"}
+ args := &commandargs.Shell{GitlabKeyId: "1"}
_, err := client.GetRecoveryCodes(args)
assert.Equal(t, "missing user", err.Error())
}
@@ -138,7 +138,7 @@ func TestErrorResponses(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- args := &commandargs.CommandArgs{GitlabKeyId: tc.fakeId}
+ args := &commandargs.Shell{GitlabKeyId: tc.fakeId}
resp, err := client.GetRecoveryCodes(args)
assert.EqualError(t, err, tc.expectedError)