Browse Source

feat:工作桌面测试用例

wangshan 3 years ago
parent
commit
7fc69df948
5 changed files with 27 additions and 11 deletions
  1. BIN
      api/api.exe
  2. 3 3
      entity/user.go
  3. BIN
      rpc/rpc.exe
  4. 17 0
      service/auxiliaryTest.go
  5. 7 8
      service/workDesktop_test.go

BIN
api/api.exe


+ 3 - 3
entity/user.go

@@ -14,7 +14,7 @@ const (
 	BigMemberUserPowerTable = "bigmember_service_user"
 	RedisCode               = "newother"
 	RedisMenuKey            = "jy_workdesktopmenu_%s_%s"
-	UserPowerRedisKey       = "jy_userpowerredis_%s_%s"
+	UserPowerRedisKey       = "jy_userpowerredis_%s_%d_%s"
 )
 
 var (
@@ -38,7 +38,7 @@ func AutoUserPowerInfo(userId, appId string, internalTime int, bigMemberOff bool
 	* 免费用户--》新免费用户
 	 */
 	//redis newother 查询是否存在用户功能信息
-	userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, appId, userId)
+	userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, appId, time.Now().Day(), userId)
 	bytes, err := redis.GetBytes(RedisCode, userPowerRedisKey)
 	if err == nil && len(*bytes) > 0 {
 		var userPowerData = map[string]int{}
@@ -143,6 +143,6 @@ func AutoUserPowerInfo(userId, appId string, internalTime int, bigMemberOff bool
 
 //clear One
 func ClearUserPowerFunc(userId, appId string) {
-	userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, appId, userId)
+	userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, appId, time.Now().Day(), userId)
 	redis.Del(RedisCode, userPowerRedisKey)
 }

BIN
rpc/rpc.exe


+ 17 - 0
service/auxiliaryTest.go

@@ -0,0 +1,17 @@
+package service
+
+import (
+	"github.com/zeromicro/go-zero/core/discov"
+	"github.com/zeromicro/go-zero/zrpc"
+	usercenterclient "userCenter/rpc/usercenter"
+)
+
+func AutoInit() usercenterclient.UserCenter {
+	FileSystemConf := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: []string{"127.0.0.1:2379"},
+			Key:   "usercenter.rpc",
+		},
+	})
+	return usercenterclient.NewUserCenter(FileSystemConf)
+}

+ 7 - 8
rpc/test/workDesktop_test.go → service/workDesktop_test.go

@@ -1,13 +1,11 @@
-package test
+package service
 
 import (
 	"context"
-	"github.com/zeromicro/go-zero/zrpc"
 	"log"
 	"testing"
 	"time"
 	"userCenter/rpc/pb"
-	usercenterclient "userCenter/rpc/usercenter"
 )
 
 var (
@@ -17,14 +15,15 @@ var (
 // 菜单模式选择
 // go test -v -run Test_MenuMode
 func Test_MenuMode(t *testing.T) {
-	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	FileSystem := AutoInit()
+	AutoInit()
 	req := &pb.WorkDesktopComprehensiveReq{
 		UserId:     "61e7820581197c2e50af18df",
 		AppId:      "10000",
 		Platform:   "PC",
 		Phone:      "",
 		ActionMode: "menuMode",
-		MenuMode:   "all",
+		MenuMode:   "usable",
 		MenuIds:    "",
 	}
 	res, err := FileSystem.WorkDesktopComprehensive(ctx, req)
@@ -35,7 +34,7 @@ func Test_MenuMode(t *testing.T) {
 // 常用功能更新
 // go test -v -run Test_CommonlyRenew
 func Test_CommonlyRenew(t *testing.T) {
-	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	FileSystem := AutoInit()
 	req := &pb.WorkDesktopComprehensiveReq{
 		UserId:     "61e7820581197c2e50af18df",
 		AppId:      "10000",
@@ -53,7 +52,7 @@ func Test_CommonlyRenew(t *testing.T) {
 // 常用功能列表
 // go test -v -run Test_CommonlyList
 func Test_CommonlyList(t *testing.T) {
-	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	FileSystem := AutoInit()
 	req := &pb.WorkDesktopComprehensiveReq{
 		UserId:     "61e7820581197c2e50af18df",
 		AppId:      "10000",
@@ -71,7 +70,7 @@ func Test_CommonlyList(t *testing.T) {
 //工作桌面菜单树
 //go test -run=Test_WorkDesktopMenuTree
 func Test_WorkDesktopMenuTree(t *testing.T) {
-	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	FileSystem := AutoInit()
 	req := &pb.WorkDesktopMenuInfoReq{
 		UserId:   "61e7820581197c2e50af18df",
 		AppId:    "10000",