update tests and deps

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-07-05 16:26:57 +03:00
parent 3ceff22f52
commit 32039b342f
17 changed files with 826 additions and 105 deletions

View File

@@ -50,13 +50,14 @@ func TestError(t *testing.T) {
c := client.NewClientCallOptions(mhttp.NewClient(client.ContentType("application/json"), client.Codec("application/json", jsoncodec.NewCodec())), client.WithAddress("https://api.github.com"))
req := c.NewRequest("github", "/dddd", &pb.LookupUserReq{})
rsp := &GithubRsp{}
errMap := map[string]interface{}{"404": &GithubRspError{}}
err := c.Call(context.TODO(), req, rsp, mhttp.Method(http.MethodGet), mhttp.ErrorMap(errMap))
errMap := map[string]interface{}{"404": &pb.Error{}}
err := mhttp.GetError(c.Call(context.TODO(), req, rsp, mhttp.Method(http.MethodGet), mhttp.ErrorMap(errMap)))
if err == nil {
t.Fatal("request must return non nil err")
}
if _, ok := err.(*GithubRspError); !ok {
t.Fatalf("invalid response received: %T is not *GithubRspError type: %#+v", err, err)
if _, ok := err.(*pb.Error); !ok {
t.Fatalf("invalid response received: %T is not *pb.Error type: %#+v", err, err)
}
}