golang-im聊天
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

business_int_test.go 844 B

pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package api
  2. import (
  3. "fmt"
  4. "gim/pkg/pb"
  5. "testing"
  6. "google.golang.org/grpc"
  7. )
  8. func getBusinessIntClient() pb.BusinessIntClient {
  9. //conn, err := grpc.Dial("localhost:50300", grpc.WithInsecure())
  10. conn, err := grpc.Dial("im-rpc-business.izhyin.com:8000", grpc.WithInsecure())
  11. if err != nil {
  12. fmt.Println(err)
  13. return nil
  14. }
  15. return pb.NewBusinessIntClient(conn)
  16. }
  17. func TestUserIntServer_Auth(t *testing.T) {
  18. _, err := getBusinessIntClient().Auth(getCtx(), &pb.AuthReq{
  19. UserId: 2,
  20. DeviceId: 1,
  21. Token: "0",
  22. })
  23. fmt.Println(err)
  24. }
  25. func TestUserIntServer_GetUsers(t *testing.T) {
  26. resp, err := getBusinessIntClient().GetUsers(getCtx(), &pb.GetUsersReq{
  27. UserIds: map[int64]int32{1: 0, 2: 0, 3: 0},
  28. })
  29. if err != nil {
  30. fmt.Println(err)
  31. return
  32. }
  33. for k, v := range resp.Users {
  34. fmt.Printf("%+-5v %+v\n", k, v)
  35. }
  36. }