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

Side by Side Diff: impl/dummy/dummy.go

Issue 1525923002: Implement Mail service. (Closed) Base URL: https://github.com/luci/gae.git@filter_user
Patch Set: add tests 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package dummy 5 package dummy
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "runtime" 9 "runtime"
10 "strings" 10 "strings"
11 "time" 11 "time"
12 12
13 "github.com/luci/gae/service/datastore" 13 "github.com/luci/gae/service/datastore"
14 "github.com/luci/gae/service/info" 14 "github.com/luci/gae/service/info"
15 "github.com/luci/gae/service/mail"
15 "github.com/luci/gae/service/memcache" 16 "github.com/luci/gae/service/memcache"
16 "github.com/luci/gae/service/taskqueue" 17 "github.com/luci/gae/service/taskqueue"
17 "github.com/luci/gae/service/user" 18 "github.com/luci/gae/service/user"
18 "golang.org/x/net/context" 19 "golang.org/x/net/context"
19 ) 20 )
20 21
21 const niFmtStr = "dummy: method %s.%s is not implemented" 22 const niFmtStr = "dummy: method %s.%s is not implemented"
22 23
23 // ni returns an error whose message is an appropriate expansion of niFmtStr. 24 // ni returns an error whose message is an appropriate expansion of niFmtStr.
24 // 25 //
(...skipping 16 matching lines...) Expand all
41 f := runtime.FuncForPC(ptr) 42 f := runtime.FuncForPC(ptr)
42 n := f.Name() 43 n := f.Name()
43 if n != "" { 44 if n != "" {
44 parts := strings.Split(n, ".") 45 parts := strings.Split(n, ".")
45 if len(parts) > 2 { 46 if len(parts) > 2 {
46 switch parts[len(parts)-2] { 47 switch parts[len(parts)-2] {
47 case "ds": 48 case "ds":
48 iface = "Datastore" 49 iface = "Datastore"
49 case "i": 50 case "i":
50 iface = "Info" 51 iface = "Info"
52 case "m":
53 iface = "Mail"
51 case "mc": 54 case "mc":
52 iface = "Memcache" 55 iface = "Memcache"
53 case "tq": 56 case "tq":
54 iface = "TaskQueue" 57 iface = "TaskQueue"
55 case "u": 58 case "u":
56 iface = "User" 59 iface = "User"
57 } 60 }
58 funcName = parts[len(parts)-1] 61 funcName = parts[len(parts)-1]
59 } 62 }
60 } 63 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 func (u) LogoutURL(string) (string, error) { panic(ni()) } 178 func (u) LogoutURL(string) (string, error) { panic(ni()) }
176 func (u) OAuthConsumerKey() (string, error) { panic(ni()) } 179 func (u) OAuthConsumerKey() (string, error) { panic(ni()) }
177 func (u) Testable() user.Testable { panic(ni()) } 180 func (u) Testable() user.Testable { panic(ni()) }
178 181
179 var dummyUserInst = u{} 182 var dummyUserInst = u{}
180 183
181 // User returns a dummy user.Interface implementation suitable for embedding. 184 // User returns a dummy user.Interface implementation suitable for embedding.
182 // Every method panics with a message containing the name of the method which 185 // Every method panics with a message containing the name of the method which
183 // was unimplemented. 186 // was unimplemented.
184 func User() user.Interface { return dummyUserInst } 187 func User() user.Interface { return dummyUserInst }
188
189 ////////////////////////////////////// m ///////////////////////////////////////
190
191 type m struct{}
192
193 func (m) Send(*mail.Message) error { panic(ni()) }
194 func (m) SendToAdmins(*mail.Message) error { panic(ni()) }
195 func (m) Testable() mail.Testable { panic(ni()) }
196
197 var dummyMailInst = m{}
198
199 // Mail returns a dummy mail.Interface implementation suitable for embedding.
200 // Every method panics with a message containing the name of the method which
201 // was unimplemented.
202 func Mail() mail.Interface { return dummyMailInst }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698