You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

business_int_test.go 847 B

1 week ago
1 week ago
1 week ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package api
  2. import (
  3. "egg-im/pkg/pb"
  4. "fmt"
  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. }