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

Unified Diff: impl/dummy/dummy.go

Issue 1500433002: Add User service. (Closed) Base URL: https://github.com/luci/gae.git@inner_ctx
Patch Set: Created 5 years 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 | « no previous file | impl/dummy/dummy_test.go » ('j') | service/user/user.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/dummy/dummy.go
diff --git a/impl/dummy/dummy.go b/impl/dummy/dummy.go
index 3705ab4a3a676c4c80009bcec8faa92d541fe1d8..5134c62fcf6f9cb7b4b73945537cf5ec9ed31c33 100644
--- a/impl/dummy/dummy.go
+++ b/impl/dummy/dummy.go
@@ -14,6 +14,7 @@ import (
"github.com/luci/gae/service/info"
"github.com/luci/gae/service/memcache"
"github.com/luci/gae/service/taskqueue"
+ "github.com/luci/gae/service/user"
"golang.org/x/net/context"
)
@@ -45,12 +46,14 @@ func ni() error {
switch parts[len(parts)-2] {
case "ds":
iface = "Datastore"
+ case "i":
+ iface = "Info"
case "mc":
iface = "Memcache"
case "tq":
iface = "TaskQueue"
- case "i":
- iface = "Info"
+ case "u":
+ iface = "User"
}
funcName = parts[len(parts)-1]
}
@@ -159,3 +162,22 @@ var dummyInfoInst = i{}
// Every method panics with a message containing the name of the method which
// was unimplemented.
func Info() info.Interface { return dummyInfoInst }
+
+////////////////////////////////////// u ///////////////////////////////////////
+
+type u struct{}
+
+func (u) Current() *user.User { panic(ni()) }
+func (u) CurrentOAuth() (*user.User, error) { panic(ni()) }
+func (u) IsAdmin() bool { panic(ni()) }
+func (u) LoginURL(string) (string, error) { panic(ni()) }
+func (u) LoginURLFederated(string, string) (string, error) { panic(ni()) }
+func (u) LogoutURL(string) (string, error) { panic(ni()) }
+func (u) OAuthConsumerKey() (string, error) { panic(ni()) }
+
+var dummyUserInst = u{}
+
+// User returns a dummy user.Interface implementation suitable for embedding.
+// Every methog panics with a message containing the name of the method which
Vadim Sh. 2015/12/03 00:55:56 typo: methog
iannucci 2015/12/03 01:00:24 hehe :)
+// was unimplemented.
+func User() user.Interface { return dummyUserInst }
« no previous file with comments | « no previous file | impl/dummy/dummy_test.go » ('j') | service/user/user.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698