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

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

Issue 2977773002: [dummy/info] Mock ModuleHostname and related functions. (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | impl/dummy/dummy_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. 1 // Copyright 2015 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 type i struct{} 158 type i struct{}
159 159
160 func (i) AccessToken(...string) (token string, expiry time.Time, err error) { 160 func (i) AccessToken(...string) (token string, expiry time.Time, err error) {
161 panic(ni()) 161 panic(ni())
162 } 162 }
163 func (i) AppID() string { return "appid" } 163 func (i) AppID() string { return "appid" }
164 func (i) FullyQualifiedAppID() string { return "dummy~appid" } 164 func (i) FullyQualifiedAppID() string { return "dummy~appid" }
165 func (i) GetNamespace() string { return "dummy-namespace" } 165 func (i) GetNamespace() string { return "dummy-namespace" }
166 func (i) ModuleHostname(module, version, instance string) (string, error) { 166 func (i) ModuleHostname(module, version, instance string) (string, error) {
167 » panic(ni()) 167 » if instance != "" {
168 » » panic(ni())
169 » }
170 » if module == "" {
171 » » module = "module"
172 » }
173 » if version == "" {
174 » » version = "version"
175 » }
176 » return fmt.Sprintf("%s.%s.dummy-appid.example.com", version, module), ni l
168 } 177 }
169 func (i) ModuleName() string { panic (ni()) } 178 func (i) ModuleName() string { retur n "module" }
170 func (i) DefaultVersionHostname() string { panic (ni()) } 179 func (i) DefaultVersionHostname() string { retur n "dummy-appid.example.com" }
171 func (i) PublicCertificates() ([]info.Certificate, error) { panic (ni()) } 180 func (i) PublicCertificates() ([]info.Certificate, error) { panic (ni()) }
172 func (i) RequestID() string { panic (ni()) } 181 func (i) RequestID() string { panic (ni()) }
173 func (i) ServiceAccount() (string, error) { panic (ni()) } 182 func (i) ServiceAccount() (string, error) { panic (ni()) }
174 func (i) SignBytes([]byte) (keyName string, signature []byte, err error) { panic (ni()) } 183 func (i) SignBytes([]byte) (keyName string, signature []byte, err error) { panic (ni()) }
175 func (i) VersionID() string { panic (ni()) } 184 func (i) VersionID() string { panic (ni()) }
176 func (i) Namespace(string) (context.Context, error) { panic (ni()) } 185 func (i) Namespace(string) (context.Context, error) { panic (ni()) }
177 func (i) Datacenter() string { panic (ni()) } 186 func (i) Datacenter() string { panic (ni()) }
178 func (i) InstanceID() string { panic (ni()) } 187 func (i) InstanceID() string { panic (ni()) }
179 func (i) IsDevAppServer() bool { panic (ni()) } 188 func (i) IsDevAppServer() bool { panic (ni()) }
180 func (i) ServerSoftware() string { panic (ni()) } 189 func (i) ServerSoftware() string { panic (ni()) }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 func (mod) DefaultVersion(module string) (string, error) { panic(ni()) } 247 func (mod) DefaultVersion(module string) (string, error) { panic(ni()) }
239 func (mod) Start(module, version string) error { panic(ni()) } 248 func (mod) Start(module, version string) error { panic(ni()) }
240 func (mod) Stop(module, version string) error { panic(ni()) } 249 func (mod) Stop(module, version string) error { panic(ni()) }
241 250
242 var dummyModuleInst = mod{} 251 var dummyModuleInst = mod{}
243 252
244 // Module returns a dummy module.Interface implementation suitable for 253 // Module returns a dummy module.Interface implementation suitable for
245 // embedding. Every method panics with a message containing the name of the 254 // embedding. Every method panics with a message containing the name of the
246 // method which was unimplemented. 255 // method which was unimplemented.
247 func Module() module.RawInterface { return dummyModuleInst } 256 func Module() module.RawInterface { return dummyModuleInst }
OLDNEW
« no previous file with comments | « no previous file | impl/dummy/dummy_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698