getkeylogic_test.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package logic
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "jyBXSubscribe/rpc/internal/svc"
  6. "jyBXSubscribe/rpc/type/bxsubscribe"
  7. "reflect"
  8. "testing"
  9. )
  10. func TestGetKeyLogic_GetKey(t *testing.T) {
  11. type fields struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. Logger logx.Logger
  15. }
  16. type args struct {
  17. in *bxsubscribe.GetKeyReq
  18. }
  19. tests := []struct {
  20. name string
  21. fields fields
  22. args args
  23. want *bxsubscribe.Items
  24. wantErr bool
  25. }{
  26. // TODO: Add test cases.
  27. {
  28. name: "超级订阅获取",
  29. args: args{
  30. in: &bxsubscribe.GetKeyReq{
  31. UserType: "mType",
  32. UserId: "5e8eb60ae138234b4f91aacf",
  33. EntId: "14640",
  34. AppId: "10000",
  35. EntUserId: "4962",
  36. NewUserId: 185483,
  37. UserPower: 0,
  38. MemberPower: 0,
  39. IsEnt: false,
  40. },
  41. },
  42. },
  43. }
  44. for _, tt := range tests {
  45. t.Run(tt.name, func(t *testing.T) {
  46. l := &GetKeyLogic{
  47. ctx: tt.fields.ctx,
  48. svcCtx: tt.fields.svcCtx,
  49. Logger: tt.fields.Logger,
  50. }
  51. got, err := l.GetKey(tt.args.in)
  52. if (err != nil) != tt.wantErr {
  53. t.Errorf("GetKey() error = %v, wantErr %v", err, tt.wantErr)
  54. return
  55. }
  56. if !reflect.DeepEqual(got, tt.want) {
  57. t.Errorf("GetKey() got = %v, want %v", got, tt.want)
  58. }
  59. })
  60. }
  61. }
  62. func TestNewGetKeyLogic(t *testing.T) {
  63. type args struct {
  64. ctx context.Context
  65. svcCtx *svc.ServiceContext
  66. }
  67. tests := []struct {
  68. name string
  69. args args
  70. want *GetKeyLogic
  71. }{
  72. // TODO: Add test cases.
  73. }
  74. for _, tt := range tests {
  75. t.Run(tt.name, func(t *testing.T) {
  76. if got := NewGetKeyLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  77. t.Errorf("NewGetKeyLogic() = %v, want %v", got, tt.want)
  78. }
  79. })
  80. }
  81. }