Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Unified Diff: go/src/infra/libs/auth/auth_test.go

Issue 1149313002: go: Replace Logrus with go-logging. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: typo Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/libs/auth/auth.go ('k') | go/src/infra/libs/logging/appengine.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 })
« no previous file with comments | « go/src/infra/libs/auth/auth.go ('k') | go/src/infra/libs/logging/appengine.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698