123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- package service
- import (
- // "reflect"
- "testing"
- "app.yhyue.com/moapp/jybase/mongodb"
- "app.yhyue.com/moapp/jybase/mysql"
- "app.yhyue.com/moapp/jybase/redis"
- "bp.jydev.jianyu360.cn/BaseService/entManageApplication/entity"
- "bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/pb"
- "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
- "github.com/zeromicro/go-zero/core/discov"
- "github.com/zeromicro/go-zero/zrpc"
- )
- func init() {
- entity.JyMysql = &mysql.Mysql{
- Address: "192.168.3.11:3366",
- UserName: "root",
- PassWord: "Topnet123",
- DBName: "jianyu",
- MaxOpenConns: 5,
- MaxIdleConns: 5,
- }
- entity.JyMysql.Init()
- entity.Mgo = mongodb.NewMgo("192.168.3.206:27080", "qfw", 10)
- redis.InitRedisBySize("newother=192.168.3.206:1712", 100, 30, 300)
- //用户中台配置
- userClient := zrpc.MustNewClient(zrpc.RpcClientConf{
- Etcd: discov.EtcdConf{
- Hosts: []string{"192.168.3.149:2379"},
- Key: "usercenter.rpc",
- },
- })
- entity.UserCenterRpc = usercenter.NewUserCenter(userClient)
- }
- func TestAddUsePerson(t *testing.T) {
- tests := []struct {
- name string
- args *pb.AddUsePersonReq
- want string
- }{
- {
- name: "添加使用人员",
- args: &pb.AddUsePersonReq{
- EntId: 15051,
- EntUserId: "4623",
- WaitEmpowerId: 432,
- },
- want: "",
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- AddUsePerson(tt.args)
- // if got := AddUsePerson(tt.args); !reflect.DeepEqual(got, tt.want) {
- // t.Errorf("AddUsePerson() = %v, want %v", got, tt.want)
- // }
- })
- }
- }
- func TestBuyProductList(t *testing.T) {
- tests := []struct {
- name string
- args *pb.BuyProductListReq
- want string
- }{
- {
- name: "已购产品列表",
- args: &pb.BuyProductListReq{
- EntId: 15023,
- },
- want: "",
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- BuyProductList(tt.args)
- // if got := BuyProductList(tt.args); !reflect.DeepEqual(got, tt.want) {
- // t.Errorf("BuyProductList() = %v, want %v", got, tt.want)
- // }
- })
- }
- }
- func TestDelUsePerson(t *testing.T) {
- tests := []struct {
- name string
- args *pb.DelUsePersonReq
- want string
- }{
- {
- name: "删除使用人员",
- args: &pb.DelUsePersonReq{
- EntnichePowerId: 52,
- },
- want: "",
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- DelUsePerson(tt.args)
- // if got := DelUsePerson(tt.args); !reflect.DeepEqual(got, tt.want) {
- // t.Errorf("DelUsePerson() = %v, want %v", got, tt.want)
- // }
- })
- }
- }
- func TestUsePersonList(t *testing.T) {
- tests := []struct {
- name string
- args *pb.UsePersonListReq
- want string
- }{
- {
- name: "使用人员列表",
- args: &pb.UsePersonListReq{
- EntId: 15023,
- WaitEmpowerId: 18,
- },
- want: "",
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- UsePersonList(tt.args)
- // if got := UsePersonList(tt.args); !reflect.DeepEqual(got, tt.want) {
- // t.Errorf("UsePersonList() = %v, want %v", got, tt.want)
- // }
- })
- }
- }
- func TestEmpowerUserIds(t *testing.T) {
- t.Log(EmpowerUserIds([]int64{5388, 5391}).Ids)
- }
|