First stab at mock client

This commit is contained in:
Asim
2016-04-06 18:33:57 +01:00
parent bfe20d81d0
commit ac6b8b730b
4 changed files with 239 additions and 0 deletions

16
client/mock/context.go Normal file
View 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)
}