Index: go/src/infra/libs/auth/auth_test.go |
diff --git a/go/src/infra/libs/auth/auth_test.go b/go/src/infra/libs/auth/auth_test.go |
index c0b30d1b335d1cdc955c76d36ea879636f9a0282..3408698b2da38222c101620f89ff38d942e55f80 100644 |
--- a/go/src/infra/libs/auth/auth_test.go |
+++ b/go/src/infra/libs/auth/auth_test.go |
@@ -19,14 +19,18 @@ import ( |
. "github.com/smartystreets/goconvey/convey" |
) |
+var ( |
+ log = logging.DefaultLogger |
+) |
+ |
func ExampleDefaultAuthenticatedClient() { |
client, err := DefaultAuthenticatedClient(SilentLogin) |
if err == ErrLoginRequired { |
- logging.Errorf("Run 'auth login' to login") |
+ log.Errorf("Run 'auth login' to login") |
return |
} |
if err != nil { |
- logging.Errorf("Failed to login: %s", err) |
+ log.Errorf("Failed to login: %s", err) |
return |
} |
client.Get("https://some-server.appspot.com") |
@@ -57,14 +61,6 @@ func mockTokenProvider(factory func() internal.TokenProvider) { |
}) |
} |
-func mockTerminal() { |
- prev := logging.IsTerminal |
- logging.IsTerminal = true |
- Reset(func() { |
- logging.IsTerminal = prev |
- }) |
-} |
- |
func TestAuthenticator(t *testing.T) { |
Convey("Given mocked secrets dir", t, func() { |
tempDir := mockSecretsDir() |
@@ -114,7 +110,6 @@ func TestAuthenticatedClient(t *testing.T) { |
Convey("Given mocked secrets dir", t, func() { |
var tokenProvider internal.TokenProvider |
- mockTerminal() |
mockSecretsDir() |
mockTokenProvider(func() internal.TokenProvider { return tokenProvider }) |
@@ -138,7 +133,6 @@ func TestRefreshToken(t *testing.T) { |
Convey("Given mocked secrets dir", t, func() { |
var tokenProvider *fakeTokenProvider |
- mockTerminal() |
mockSecretsDir() |
mockTokenProvider(func() internal.TokenProvider { return tokenProvider }) |