workDesktop_test.go 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. package service
  2. import (
  3. "app.yhyue.com/moapp/jybase/redis"
  4. "context"
  5. "fmt"
  6. "log"
  7. "testing"
  8. "time"
  9. "userCenter/entity"
  10. "userCenter/rpc/pb"
  11. )
  12. var (
  13. ctx, _ = context.WithTimeout(context.Background(), 2*time.Second)
  14. )
  15. //工作桌面菜单树 无缓存
  16. //go test -run=Test_WorkDesktopMenuTreeNoCache
  17. func Test_WorkDesktopMenuTreeNoCache(t *testing.T) {
  18. in := &pb.WorkDesktopMenuInfoReq{
  19. UserId: "61e7820581197c2e50af18df",
  20. AppId: "10000",
  21. Platform: "PC",
  22. Phone: "",
  23. BigMemberOff: true,
  24. InternalTime: 1200,
  25. RedisOutTime: 1200,
  26. }
  27. RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
  28. redis.Del(entity.RedisCode, RedisMenuKey)
  29. res, err := GetWordDesktopMenuTree(in)
  30. log.Println("err:", err, "---res:", res)
  31. }
  32. //工作桌面菜单树
  33. //go test -run=Test_WorkDesktopMenuTree
  34. func Test_WorkDesktopMenuTree(t *testing.T) {
  35. in := &pb.WorkDesktopMenuInfoReq{
  36. UserId: "61e7820581197c2e50af18df",
  37. AppId: "10000",
  38. Platform: "PC",
  39. Phone: "",
  40. BigMemberOff: true,
  41. InternalTime: 1200,
  42. RedisOutTime: 1200,
  43. }
  44. res, err := GetWordDesktopMenuTree(in)
  45. log.Println("err:", err, "---res:", res)
  46. }
  47. //工作桌面菜单树
  48. //go test -run=Test_WorkDesktopMenuTreeWX
  49. func Test_WorkDesktopMenuTreeWX(t *testing.T) {
  50. in := &pb.WorkDesktopMenuInfoReq{
  51. UserId: "61e7820581197c2e50af18df",
  52. AppId: "10000",
  53. Platform: "WX",
  54. Phone: "",
  55. BigMemberOff: true,
  56. InternalTime: 1200,
  57. RedisOutTime: 1200,
  58. }
  59. RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
  60. redis.Del(entity.RedisCode, RedisMenuKey)
  61. res, err := GetWordDesktopMenuTree(in)
  62. log.Println("err:", err, "---res:", res)
  63. }
  64. //工作桌面菜单树
  65. //go test -run=Test_WorkDesktopMenuTreeAPP
  66. func Test_WorkDesktopMenuTreeAPP(t *testing.T) {
  67. in := &pb.WorkDesktopMenuInfoReq{
  68. UserId: "61e7820581197c2e50af18df",
  69. AppId: "10000",
  70. Platform: "APP",
  71. Phone: "",
  72. BigMemberOff: true,
  73. InternalTime: 1200,
  74. RedisOutTime: 1200,
  75. }
  76. RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
  77. redis.Del(entity.RedisCode, RedisMenuKey)
  78. res, err := GetWordDesktopMenuTree(in)
  79. log.Println("err:", err, "---res:", res)
  80. }
  81. // 菜单模式插入
  82. // go test -v -run Test_MenuModeSave
  83. func Test_MenuModeSave(t *testing.T) {
  84. in := &pb.WorkDesktopComprehensiveReq{
  85. UserId: "61e7820581197c2e50af18df",
  86. AppId: "10000",
  87. Platform: "PC",
  88. Phone: "",
  89. ActionMode: "menuMode",
  90. MenuMode: "usable",
  91. MenuIds: "",
  92. BigMemberOff: true,
  93. CommonlySize: 10,
  94. RedisOutTime: 1200,
  95. }
  96. res := RenewWorkDesktopMenuModeOrCommonly(in)
  97. log.Println("menuModeNew:", res)
  98. }
  99. // 菜单模式更新-非指定内容
  100. // go test -v -run Test_MenuModeUpdateWrong
  101. func Test_MenuModeUpdateWrong(t *testing.T) {
  102. in := &pb.WorkDesktopComprehensiveReq{
  103. UserId: "61e7820581197c2e50af18df",
  104. AppId: "10000",
  105. Platform: "PC",
  106. Phone: "",
  107. ActionMode: "menuMode",
  108. MenuMode: "allll",
  109. MenuIds: "",
  110. BigMemberOff: true,
  111. CommonlySize: 10,
  112. RedisOutTime: 1200,
  113. }
  114. res := RenewWorkDesktopMenuModeOrCommonly(in)
  115. log.Println("menuModeNew:", res)
  116. }
  117. // 菜单模式更新
  118. // go test -v -run Test_MenuModeUpdate
  119. func Test_MenuModeUpdate(t *testing.T) {
  120. in := &pb.WorkDesktopComprehensiveReq{
  121. UserId: "61e7820581197c2e50af18df",
  122. AppId: "10000",
  123. Platform: "PC",
  124. Phone: "",
  125. ActionMode: "menuMode",
  126. MenuMode: "all",
  127. MenuIds: "",
  128. BigMemberOff: true,
  129. CommonlySize: 10,
  130. RedisOutTime: 1200,
  131. }
  132. res := RenewWorkDesktopMenuModeOrCommonly(in)
  133. log.Println("menuModeNew:", res)
  134. }
  135. //当前工作桌面菜单模式
  136. // go test -v -run Test_WorkMenuMode
  137. func Test_WorkMenuMode(t *testing.T) {
  138. in := &pb.WorkDesktopMenuInfoReq{
  139. UserId: "61e7820581197c2e50af18df",
  140. AppId: "10000",
  141. Platform: "PC",
  142. Phone: "",
  143. BigMemberOff: true,
  144. InternalTime: 1200,
  145. RedisOutTime: 1200,
  146. }
  147. res, err := GetWorkDesktopMenuMode(in)
  148. log.Println("err:", err, "---res:", res)
  149. }
  150. // 当前工作桌面菜单模式-非正常用户
  151. // go test -v -run Test_WorkMenuModeNoUserId
  152. func Test_WorkMenuModeNoUserId(t *testing.T) {
  153. in := &pb.WorkDesktopMenuInfoReq{
  154. UserId: "",
  155. AppId: "10000",
  156. Platform: "PC",
  157. Phone: "",
  158. BigMemberOff: true,
  159. InternalTime: 1200,
  160. RedisOutTime: 1200,
  161. }
  162. res, err := GetWorkDesktopMenuMode(in)
  163. log.Println("err:", err, "---res:", res)
  164. }
  165. // 常用功能更新新增
  166. // go test -v -run Test_CommonlyRenewWX
  167. func Test_CommonlyRenewWX(t *testing.T) {
  168. in := &pb.WorkDesktopComprehensiveReq{
  169. UserId: "61e7820581197c2e50af18df",
  170. AppId: "10000",
  171. Platform: "WX",
  172. Phone: "",
  173. ActionMode: "commonlyRenew",
  174. MenuMode: "",
  175. MenuIds: "Q1o=,TF4=,TFw=,TFg=,Q1g=,RV9F,RV9J,RV5B,RV5H,RV5J,TVg=",
  176. }
  177. res := RenewWorkDesktopMenuModeOrCommonly(in)
  178. log.Println("res:", res)
  179. }
  180. // 常用功能更新新增
  181. // go test -v -run Test_CommonlyRenewAPP
  182. func Test_CommonlyRenewAPP(t *testing.T) {
  183. in := &pb.WorkDesktopComprehensiveReq{
  184. UserId: "61e7820581197c2e50af18df",
  185. AppId: "10000",
  186. Platform: "APP",
  187. Phone: "",
  188. ActionMode: "commonlyRenew",
  189. MenuMode: "",
  190. MenuIds: "Q1o=,TF4=,TFw=,TFg=,Q1g=,RV9F,RV9J,RV5B,RV5H,RV5J,TVg=",
  191. }
  192. res := RenewWorkDesktopMenuModeOrCommonly(in)
  193. log.Println("res:", res)
  194. }
  195. // 常用功能更新新增
  196. // go test -v -run Test_CommonlyRenew
  197. func Test_CommonlyRenew(t *testing.T) {
  198. in := &pb.WorkDesktopComprehensiveReq{
  199. UserId: "61e7820581197c2e50af18df",
  200. AppId: "10000",
  201. Platform: "PC",
  202. Phone: "",
  203. ActionMode: "commonlyRenew",
  204. MenuMode: "",
  205. MenuIds: "Q1o=,TF4=,TFw=,TFg=,Q1g=,RV9F,RV9J,RV5B,RV5H,RV5J,TVg=",
  206. }
  207. res := RenewWorkDesktopMenuModeOrCommonly(in)
  208. log.Println("res:", res)
  209. }
  210. // 常用功能列表
  211. // go test -v -run Test_CommonlyList
  212. func Test_CommonlyList(t *testing.T) {
  213. in := &pb.WorkDesktopComprehensiveReq{
  214. UserId: "61e7820581197c2e50af18df",
  215. AppId: "10000",
  216. Platform: "PC",
  217. Phone: "",
  218. ActionMode: "commonlyList",
  219. MenuMode: "",
  220. MenuIds: "",
  221. }
  222. res := RenewWorkDesktopMenuModeOrCommonly(in)
  223. log.Println("res:", res)
  224. } // 常用功能列表
  225. // go test -v -run Test_CommonlyListWX
  226. func Test_CommonlyListWX(t *testing.T) {
  227. in := &pb.WorkDesktopComprehensiveReq{
  228. UserId: "61e7820581197c2e50af18df",
  229. AppId: "10000",
  230. Platform: "WX",
  231. Phone: "",
  232. ActionMode: "commonlyList",
  233. MenuMode: "",
  234. MenuIds: "",
  235. }
  236. res := RenewWorkDesktopMenuModeOrCommonly(in)
  237. log.Println("res:", res)
  238. } // 常用功能列表
  239. // go test -v -run Test_CommonlyListAPP
  240. func Test_CommonlyListAPP(t *testing.T) {
  241. in := &pb.WorkDesktopComprehensiveReq{
  242. UserId: "61e7820581197c2e50af18df",
  243. AppId: "10000",
  244. Platform: "APP",
  245. Phone: "",
  246. ActionMode: "commonlyList",
  247. MenuMode: "",
  248. MenuIds: "",
  249. }
  250. res := RenewWorkDesktopMenuModeOrCommonly(in)
  251. log.Println("res:", res)
  252. }
  253. // 常用功能更新清空
  254. // go test -v -run Test_CommonlyRenew
  255. func Test_CommonlyClear(t *testing.T) {
  256. in := &pb.WorkDesktopComprehensiveReq{
  257. UserId: "61e7820581197c2e50af18df",
  258. AppId: "10000",
  259. Platform: "PC",
  260. Phone: "",
  261. ActionMode: "commonlyRenew",
  262. MenuMode: "",
  263. MenuIds: "",
  264. }
  265. res := RenewWorkDesktopMenuModeOrCommonly(in)
  266. log.Println("res:", res)
  267. }