handle function in mock response

This commit is contained in:
Hunyadvári Péter
2018-06-13 17:46:30 +02:00
parent cd9441fafb
commit 52a470532d
2 changed files with 7 additions and 1 deletions

View File

@@ -16,6 +16,8 @@ func TestClient(t *testing.T) {
{Method: "Foo.Bar", Response: map[string]interface{}{"foo": "bar"}},
{Method: "Foo.Struct", Response: &TestResponse{Param: "aparam"}},
{Method: "Foo.Fail", Error: errors.InternalServerError("go.mock", "failed")},
{Method: "Foo.Func", Response: func() string {return "string"}},
{Method: "Foo.FuncStruct", Response: func() *TestResponse {return &TestResponse{Param: "aparam"}}},
}
c := NewClient(Response("go.mock", response))