First stab at mock client
This commit is contained in:
16
client/mock/context.go
Normal file
16
client/mock/context.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package mock
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type responseKey struct{}
|
||||
|
||||
func fromContext(ctx context.Context) (map[string][]MockResponse, bool) {
|
||||
r, ok := ctx.Value(responseKey{}).(map[string][]MockResponse)
|
||||
return r, ok
|
||||
}
|
||||
|
||||
func newContext(ctx context.Context, r map[string][]MockResponse) context.Context {
|
||||
return context.WithValue(ctx, responseKey{}, r)
|
||||
}
|
Reference in New Issue
Block a user