getCheckInfo_test.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. package dao
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "path/filepath"
  7. "testing"
  8. fansMedalService "go-common/app/service/live/fans_medal/api/liverpc"
  9. "go-common/app/service/live/live-dm/conf"
  10. liveUserService "go-common/app/service/live/live_user/api/liverpc"
  11. roomService "go-common/app/service/live/room/api/liverpc"
  12. userextService "go-common/app/service/live/userext/api/liverpc"
  13. acctountService "go-common/app/service/main/account/api"
  14. filterService "go-common/app/service/main/filter/api/grpc/v1"
  15. spyService "go-common/app/service/main/spy/api"
  16. )
  17. func init() {
  18. dir, _ := filepath.Abs("../cmd/test.toml")
  19. flag.Set("conf", dir)
  20. var err error
  21. if err = conf.Init(); err != nil {
  22. panic(err)
  23. }
  24. // InitAPI()
  25. // InitGrpc(conf.Conf)
  26. UserExtServiceClient = userextService.New(getConf("userext"))
  27. LiveUserServiceClient = liveUserService.New(getConf("liveUser"))
  28. FansMedalServiceClient = fansMedalService.New(getConf("fansMedal"))
  29. RoomServiceClient = roomService.New(getConf("room"))
  30. ac, err = acctountService.NewClient(conf.Conf.AccClient)
  31. if err != nil {
  32. panic(err)
  33. }
  34. vipCli, err = newVipService(conf.Conf.XuserClent)
  35. if err != nil {
  36. panic(err)
  37. }
  38. SpyClient, err = spyService.NewClient(conf.Conf.SpyClient)
  39. if err != nil {
  40. panic(err)
  41. }
  42. FilterClient, err = filterService.NewClient(conf.Conf.FilterClient)
  43. if err != nil {
  44. panic(err)
  45. }
  46. }
  47. //group=qa01 DEPLOY_ENV=uat go test -run TestDMConf_Get
  48. func TestDMConf_Get(t *testing.T) {
  49. dc := &DMConf{}
  50. if err := dc.Get(context.TODO(), 111, 222, conf.Conf); err != nil {
  51. t.Error("获取弹幕配置失败", err)
  52. }
  53. if dc.Color == 0 && dc.Length == 0 && dc.Mode == 0 {
  54. t.Error("获取弹幕配置失败, 返回值错误")
  55. }
  56. fmt.Println("##### Mode: ", dc.Mode)
  57. fmt.Println("##### Color: ", dc.Color)
  58. fmt.Println("##### Length: ", dc.Length)
  59. }
  60. //TODO 未测试
  61. //group=fat1 DEPLOY_ENV=uat go test -run TestUserInfo_Get
  62. func TestUserInfo_Get(t *testing.T) {
  63. u := &UserInfo{}
  64. if err := u.Get(context.TODO(), 110000232); err != nil {
  65. t.Error(err)
  66. }
  67. if u.UserLever == 0 && u.UserScore == 0 {
  68. t.Error("返回值错误")
  69. }
  70. fmt.Println("#### UserLever: ", u.UserLever)
  71. fmt.Println("#### UserScore: ", u.UserScore)
  72. fmt.Println("### Usercolor: ", u.ULevelColor)
  73. }
  74. //DEPLOY_ENV=uat go test -run TestUserInfo_GetVipInfo
  75. func TestUserInfo_GetVipInfo(t *testing.T) {
  76. u := &UserInfo{}
  77. if err := u.GetVipInfo(context.TODO(), 2); err != nil {
  78. t.Error("获取老爷失败: ", err)
  79. }
  80. fmt.Println("#### VIP: ", u.Vip)
  81. fmt.Println("### SVIP: ", u.Svip)
  82. }
  83. //group=qa01 DEPLOY_ENV=uat go test -run TestUserInfo_GetPrivilegeType
  84. func TestUserInfo_GetPrivilegeType(t *testing.T) {
  85. u := &UserInfo{}
  86. if err := u.GetPrivilegeType(context.TODO(), 10799340, 6810576); err != nil {
  87. t.Error("返回值错误: ", err)
  88. }
  89. fmt.Println("PrivilegeType", u.PrivilegeType)
  90. }
  91. //group=qa01 DEPLOY_ENV=uat go test -run TestUserInfo_IsRoomAdmin
  92. func TestUserInfo_IsRoomAdmin(t *testing.T) {
  93. u := &UserInfo{}
  94. if err := u.IsRoomAdmin(context.TODO(), 1877309, 5392); err != nil {
  95. t.Error("返回值错误: ", err)
  96. }
  97. fmt.Println("IsRoomAdmin->", u.RoomAdmin)
  98. }
  99. //group=qa01 DEPLOY_ENV=uat go test -run TestUserInfo_GetFansMedal
  100. func TestUserInfo_GetFansMedal(t *testing.T) {
  101. m := &FansMedalInfo{}
  102. if err := m.GetFansMedal(context.TODO(), 83940); err != nil {
  103. t.Error("获取粉丝勋章失败: ", err)
  104. }
  105. fmt.Println("#####RUID: ", m.RUID)
  106. fmt.Println("#####MedalLevel: ", m.MedalLevel)
  107. fmt.Println("#####MedalName: ", m.MedalName)
  108. fmt.Println("#####MColor: ", m.MColor)
  109. }
  110. //group=qa01 DEPLOY_ENV=uat go test -run TestRoomConf_Get
  111. func TestRoomConf_Get(t *testing.T) {
  112. r := &RoomConf{}
  113. if err := r.Get(context.TODO(), 1016); err != nil {
  114. t.Error("获取房间配置失败: ", err)
  115. }
  116. fmt.Println("RoomID->", r.RoomID)
  117. fmt.Println("UID->", r.UID)
  118. fmt.Println("RoomShield->", r.RoomShield)
  119. fmt.Println("Anchor->", r.Anchor)
  120. }
  121. //group=qa01 DEPLOY_ENV=uat go test -run TestUserBindInfo_Get
  122. func TestUserBindInfo_Get(t *testing.T) {
  123. u := &UserBindInfo{}
  124. if err := u.Get(context.TODO(), 222); err != nil {
  125. t.Error("获取用户绑定信息失败: ", err)
  126. }
  127. fmt.Println("Identification->", u.Identification)
  128. fmt.Println("MobileVerify->", u.MobileVerify)
  129. fmt.Println("Uname->", u.Uname)
  130. fmt.Println("URank->", u.URank)
  131. }
  132. //DEPLOY_ENV=uat go test -run TestGerUserScore
  133. func TestGerUserScore(t *testing.T) {
  134. u := &UserScore{}
  135. if err := u.GetUserScore(context.TODO(), 111); err != nil {
  136. t.Error("获取用户真实分失败:", err)
  137. }
  138. fmt.Println("###### UserScore:", u.UserScore)
  139. }
  140. //缺少souce值
  141. //DEPLOY_ENV=uat go test -run TestGetMsgScore
  142. func TestGetMsgScore(t *testing.T) {
  143. u := &UserScore{}
  144. if err := u.GetMsgScore(context.TODO(), "fuck"); err != nil {
  145. t.Error("获取真实分失败:", err)
  146. }
  147. fmt.Println("MsgLeve->", u.MsgLevel)
  148. fmt.Println("MsgAI=>", u.MsgAI)
  149. }