diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-09-16 10:03:21 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-09-16 10:09:40 +0200 |
commit | 542b95f58da78e7d3f7f5b254008610e61d0cabe (patch) | |
tree | 606bd219742ce3f3e194fb3af4373b9551a41771 /client/go/cmd/command_tester.go | |
parent | 1a72eefec8a8c62f8b29455e15a4cc2d67eb4d0e (diff) |
Add flag/config option to control colorization
Diffstat (limited to 'client/go/cmd/command_tester.go')
-rw-r--r-- | client/go/cmd/command_tester.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/client/go/cmd/command_tester.go b/client/go/cmd/command_tester.go index 095a1af7ac3..3d19e772875 100644 --- a/client/go/cmd/command_tester.go +++ b/client/go/cmd/command_tester.go @@ -8,7 +8,6 @@ import ( "bytes" "crypto/tls" "io/ioutil" - "log" "net/http" "os" "path/filepath" @@ -16,7 +15,6 @@ import ( "testing" "time" - "github.com/logrusorgru/aurora" "github.com/spf13/pflag" "github.com/spf13/viper" "github.com/stretchr/testify/assert" @@ -34,9 +32,6 @@ func execute(cmd command, t *testing.T, client *mockHttpClient) string { util.ActiveHttpClient = client } - // Never print colors in tests - color = aurora.NewAurora(false) - // Set config dir. Use a separate one per test if none is specified if cmd.homeDir == "" { cmd.homeDir = t.TempDir() @@ -62,7 +57,9 @@ func execute(cmd command, t *testing.T, client *mockHttpClient) string { // Capture stdout and execute command var b bytes.Buffer - log.SetOutput(&b) + stdout = &b + + // Execute command and return output rootCmd.SetArgs(append(cmd.args, cmd.moreArgs...)) rootCmd.Execute() out, err := ioutil.ReadAll(&b) |