client/http: add additional tests

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-03-30 18:34:04 +03:00
parent 9c457a0c5e
commit d3a0375892
5 changed files with 86 additions and 13 deletions

View File

@@ -75,6 +75,21 @@ func TestNative(t *testing.T) {
}
func TestNativeWithoutPath(t *testing.T) {
c := client.NewClientCallOptions(mhttp.NewClient(client.ContentType("application/json"), client.Codec("application/json", jsoncodec.NewCodec())), client.WithAddress("https://api.github.com/users"))
gh := pb.NewGithubClient("github", c)
rsp, err := gh.LookupUserWithoutPath(context.TODO(), &pb.LookupUserReq{Username: "vtolstov"})
if err != nil {
t.Fatal(err)
}
if rsp.Name != "Vasiliy Tolstov" {
t.Fatalf("invalid rsp received: %#+v\n", rsp)
}
}
func TestHTTPClient(t *testing.T) {
reg := register.NewRegister()
rtr := rrouter.NewRouter(router.Register(reg))