ent_test.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package test
  2. import (
  3. "context"
  4. // "flag"
  5. "log"
  6. "testing"
  7. "time"
  8. "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
  9. usercenterclient "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
  10. "github.com/zeromicro/go-zero/core/conf"
  11. "github.com/zeromicro/go-zero/zrpc"
  12. )
  13. type Config struct {
  14. zrpc.RpcServerConf
  15. Node int // 节点
  16. CalleeId string // 服务名字
  17. FileSystemConf zrpc.RpcClientConf
  18. }
  19. var c Config
  20. func init() {
  21. conf.MustLoad("usercenter.yaml", &c)
  22. }
  23. // go test -v -run Test_CheckEnt
  24. func Test_CheckEnt(t *testing.T) {
  25. ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
  26. FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
  27. req := &pb.CheckEntReq{
  28. EntId: 1,
  29. }
  30. res, err := FileSystem.CheckEnt(ctx, req)
  31. log.Println("err ", err)
  32. log.Println("res:", res)
  33. }
  34. //
  35. func Test_EntAuth(t *testing.T) {
  36. ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
  37. FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
  38. req := &pb.EntAuthReq{
  39. Name: "张鑫磊企业2",
  40. AuthPhone: "15538267985",
  41. CreditCode: "asdqweqweasd",
  42. RegPhone: "15538267985",
  43. ComPanyType: "1",
  44. AreaNumber: "1c00100010001",
  45. Business: "https://www.baidu.com",
  46. OfficialLetter: "https://www.jianyu360.cn",
  47. AuthName: "郭靖2",
  48. OrganizationType: "2",
  49. EntId: "21",
  50. }
  51. res, err := FileSystem.EntAuth(ctx, req)
  52. log.Println("err ", err)
  53. log.Println("req ", res)
  54. }
  55. // go test -v -run Test_EntExamine
  56. func Test_EntExamine(t *testing.T) {
  57. ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
  58. FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
  59. req := &pb.ExamineReq{
  60. EntId: "14823",
  61. AuthType: "2",
  62. Reason: "",
  63. AuditUser: "少爷",
  64. ExamineId: "18",
  65. }
  66. res, err := FileSystem.EntExamine(ctx, req)
  67. log.Println("err ", err)
  68. log.Println("req ", res)
  69. }
  70. // go test -v -run Test_EntList
  71. func Test_EntList(t *testing.T) {
  72. ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
  73. FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
  74. req := &pb.EntListReq{
  75. Name: "企业",
  76. AuthStatus: "1",
  77. PageNum: "1",
  78. PageSize: "10",
  79. // CreditCode: data.CreditCode,
  80. // CreateStartTime: data.CreateStartTime,
  81. // CreateEndTime: data.CreateEndTime,
  82. // ValidStartTime: data.ValidStartTime,
  83. // ValidEndTime: data.ValidEndTime,
  84. // FrozenStatus: data.FrozenStatus,
  85. // RegPhone: data.RegPhone,
  86. // AuthPhone: data.AuthPhone,
  87. }
  88. res, err := FileSystem.EntList(ctx, req)
  89. log.Println("err ", err)
  90. log.Println("res:", res)
  91. }
  92. // go test -v -run Test_ExamineList
  93. func Test_ExamineList(t *testing.T) {
  94. ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
  95. FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
  96. req := &pb.ExamineListReq{
  97. Name: "中凯",
  98. AuthPhone: "",
  99. RegPhone: "",
  100. AuthType: "",
  101. AuthStartTime: "1650075550",
  102. AuthEndTime: "1681611550",
  103. PageNum: "",
  104. PageSize: "",
  105. }
  106. res, err := FileSystem.ExamineList(ctx, req)
  107. log.Println("err ", err)
  108. log.Println("res:", res)
  109. }