Test struct works with mock client

This commit is contained in:
Asim 2016-04-06 18:37:46 +01:00
parent ac6b8b730b
commit 9d060bf6e1

View File

@ -9,8 +9,13 @@ import (
)
func TestClient(t *testing.T) {
type TestRequest struct {
Param string
}
response := []MockResponse{
{Method: "Foo.Bar", Response: map[string]interface{}{"foo": "bar"}},
{Method: "Foo.Struct", Response: &TestRequest{Param: "aparam"}},
{Method: "Foo.Fail", Error: errors.InternalServerError("go.mock", "failed")},
}
@ -18,7 +23,7 @@ func TestClient(t *testing.T) {
for _, r := range response {
req := c.NewJsonRequest("go.mock", r.Method, map[string]interface{}{"foo": "bar"})
var rsp map[string]interface{}
var rsp interface{}
err := c.Call(context.TODO(), req, &rsp)