summaryrefslogtreecommitdiff
path: root/go/internal/command
diff options
context:
space:
mode:
Diffstat (limited to 'go/internal/command')
-rw-r--r--go/internal/command/discover/discover_test.go11
-rw-r--r--go/internal/command/twofactorrecover/twofactorrecover_test.go8
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})