diff options
| author | Nick Thomas <nick@gitlab.com> | 2019-04-24 11:12:29 +0000 |
|---|---|---|
| committer | Nick Thomas <nick@gitlab.com> | 2019-04-24 11:12:29 +0000 |
| commit | 344cc6b443e08ec5648fcf8a3035e46bb404fd6a (patch) | |
| tree | 0c7eae65818430d632f60433195aa08ce122aa8f /go/internal/command | |
| parent | 6e9b4dec537171c643e67fc6a73b79dd29afd068 (diff) | |
| parent | 9d9e1617ab7173ed245860612280284c7c904b58 (diff) | |
| download | gitlab-shell-344cc6b443e08ec5648fcf8a3035e46bb404fd6a.tar.gz | |
Merge branch 'id-api-regular-http' into 'master'
Support calling internal api using HTTP
See merge request gitlab-org/gitlab-shell!295
Diffstat (limited to 'go/internal/command')
| -rw-r--r-- | go/internal/command/discover/discover_test.go | 11 | ||||
| -rw-r--r-- | go/internal/command/twofactorrecover/twofactorrecover_test.go | 8 |
2 files changed, 8 insertions, 11 deletions
diff --git a/go/internal/command/discover/discover_test.go b/go/internal/command/discover/discover_test.go index a57f07e..f85add8 100644 --- a/go/internal/command/discover/discover_test.go +++ b/go/internal/command/discover/discover_test.go @@ -17,8 +17,7 @@ import ( ) var ( - testConfig = &config.Config{GitlabUrl: "http+unix://" + testserver.TestSocket} - requests = []testserver.TestRequestHandler{ + requests = []testserver.TestRequestHandler{ { Path: "/api/v4/internal/discover", Handler: func(w http.ResponseWriter, r *http.Request) { @@ -46,7 +45,7 @@ var ( ) func TestExecute(t *testing.T) { - cleanup, err := testserver.StartSocketHttpServer(requests) + cleanup, url, err := testserver.StartSocketHttpServer(requests) require.NoError(t, err) defer cleanup() @@ -79,7 +78,7 @@ func TestExecute(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - cmd := &Command{Config: testConfig, Args: tc.arguments} + cmd := &Command{Config: &config.Config{GitlabUrl: url}, Args: tc.arguments} buffer := &bytes.Buffer{} err := cmd.Execute(&readwriter.ReadWriter{Out: buffer}) @@ -91,7 +90,7 @@ func TestExecute(t *testing.T) { } func TestFailingExecute(t *testing.T) { - cleanup, err := testserver.StartSocketHttpServer(requests) + cleanup, url, err := testserver.StartSocketHttpServer(requests) require.NoError(t, err) defer cleanup() @@ -119,7 +118,7 @@ func TestFailingExecute(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - cmd := &Command{Config: testConfig, Args: tc.arguments} + cmd := &Command{Config: &config.Config{GitlabUrl: url}, Args: tc.arguments} buffer := &bytes.Buffer{} err := cmd.Execute(&readwriter.ReadWriter{Out: buffer}) diff --git a/go/internal/command/twofactorrecover/twofactorrecover_test.go b/go/internal/command/twofactorrecover/twofactorrecover_test.go index 908ee13..be76520 100644 --- a/go/internal/command/twofactorrecover/twofactorrecover_test.go +++ b/go/internal/command/twofactorrecover/twofactorrecover_test.go @@ -18,12 +18,10 @@ import ( ) var ( - testConfig *config.Config - requests []testserver.TestRequestHandler + requests []testserver.TestRequestHandler ) func setup(t *testing.T) { - testConfig = &config.Config{GitlabUrl: "http+unix://" + testserver.TestSocket} requests = []testserver.TestRequestHandler{ { Path: "/api/v4/internal/two_factor_recovery_codes", @@ -66,7 +64,7 @@ const ( func TestExecute(t *testing.T) { setup(t) - cleanup, err := testserver.StartSocketHttpServer(requests) + cleanup, url, err := testserver.StartSocketHttpServer(requests) require.NoError(t, err) defer cleanup() @@ -124,7 +122,7 @@ func TestExecute(t *testing.T) { output := &bytes.Buffer{} input := bytes.NewBufferString(tc.answer) - cmd := &Command{Config: testConfig, Args: tc.arguments} + cmd := &Command{Config: &config.Config{GitlabUrl: url}, Args: tc.arguments} err := cmd.Execute(&readwriter.ReadWriter{Out: output, In: input}) |
