updatesubscribeinfologic_test.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. package logic
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/bxsubscribe"
  6. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/internal/svc"
  7. "reflect"
  8. "testing"
  9. )
  10. func TestByPushHistoryLogic_ByPushHistory(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.SubscribeInfosReq
  18. }
  19. tests := []struct {
  20. name string
  21. fields fields
  22. args args
  23. want *bxsubscribe.ByPushHistoryResp
  24. wantErr bool
  25. }{
  26. // TODO: Add test cases.
  27. {
  28. name: "111",
  29. args: args{in: &bxsubscribe.SubscribeInfosReq{
  30. UserId: "60054",
  31. AppId: "10000",
  32. UserType: "vType",
  33. },
  34. },
  35. },
  36. }
  37. for _, tt := range tests {
  38. t.Run(tt.name, func(t *testing.T) {
  39. l := &ByPushHistoryLogic{
  40. ctx: tt.fields.ctx,
  41. svcCtx: tt.fields.svcCtx,
  42. Logger: tt.fields.Logger,
  43. }
  44. got, err := l.ByPushHistory(tt.args.in)
  45. if (err != nil) != tt.wantErr {
  46. t.Errorf("ByPushHistory() error = %v, wantErr %v", err, tt.wantErr)
  47. return
  48. }
  49. if !reflect.DeepEqual(got, tt.want) {
  50. t.Errorf("ByPushHistory() got = %v, want %v", got, tt.want)
  51. }
  52. })
  53. }
  54. }
  55. func TestGetDistributorLogic_GetDistributor(t *testing.T) {
  56. type fields struct {
  57. ctx context.Context
  58. svcCtx *svc.ServiceContext
  59. Logger logx.Logger
  60. }
  61. type args struct {
  62. in *bxsubscribe.GetDistributorReq
  63. }
  64. tests := []struct {
  65. name string
  66. fields fields
  67. args args
  68. want *bxsubscribe.DistributorResp
  69. wantErr bool
  70. }{
  71. // TODO: Add test cases.
  72. }
  73. for _, tt := range tests {
  74. t.Run(tt.name, func(t *testing.T) {
  75. l := &GetDistributorLogic{
  76. ctx: tt.fields.ctx,
  77. svcCtx: tt.fields.svcCtx,
  78. Logger: tt.fields.Logger,
  79. }
  80. got, err := l.GetDistributor(tt.args.in)
  81. if (err != nil) != tt.wantErr {
  82. t.Errorf("GetDistributor() error = %v, wantErr %v", err, tt.wantErr)
  83. return
  84. }
  85. if !reflect.DeepEqual(got, tt.want) {
  86. t.Errorf("GetDistributor() got = %v, want %v", got, tt.want)
  87. }
  88. })
  89. }
  90. }
  91. func TestGetKeyLogic_GetKey(t *testing.T) {
  92. type fields struct {
  93. ctx context.Context
  94. svcCtx *svc.ServiceContext
  95. Logger logx.Logger
  96. }
  97. type args struct {
  98. in *bxsubscribe.GetKeyReq
  99. }
  100. tests := []struct {
  101. name string
  102. fields fields
  103. args args
  104. want *bxsubscribe.KeyResp
  105. wantErr bool
  106. }{
  107. // TODO: Add test cases.
  108. }
  109. for _, tt := range tests {
  110. t.Run(tt.name, func(t *testing.T) {
  111. l := &GetKeyLogic{
  112. ctx: tt.fields.ctx,
  113. svcCtx: tt.fields.svcCtx,
  114. Logger: tt.fields.Logger,
  115. }
  116. got, err := l.GetKey(tt.args.in)
  117. if (err != nil) != tt.wantErr {
  118. t.Errorf("GetKey() error = %v, wantErr %v", err, tt.wantErr)
  119. return
  120. }
  121. if !reflect.DeepEqual(got, tt.want) {
  122. t.Errorf("GetKey() got = %v, want %v", got, tt.want)
  123. }
  124. })
  125. }
  126. }
  127. func TestGetSubListLogic_GetSubList(t *testing.T) {
  128. type fields struct {
  129. ctx context.Context
  130. svcCtx *svc.ServiceContext
  131. Logger logx.Logger
  132. }
  133. type args struct {
  134. in *bxsubscribe.SubscribeInfosReq
  135. }
  136. tests := []struct {
  137. name string
  138. fields fields
  139. args args
  140. want *bxsubscribe.SubscribeInfosResp
  141. wantErr bool
  142. }{
  143. // TODO: Add test cases.
  144. }
  145. for _, tt := range tests {
  146. t.Run(tt.name, func(t *testing.T) {
  147. l := &GetSubListLogic{
  148. ctx: tt.fields.ctx,
  149. svcCtx: tt.fields.svcCtx,
  150. Logger: tt.fields.Logger,
  151. }
  152. got, err := l.GetSubList(tt.args.in)
  153. if (err != nil) != tt.wantErr {
  154. t.Errorf("GetSubList() error = %v, wantErr %v", err, tt.wantErr)
  155. return
  156. }
  157. if !reflect.DeepEqual(got, tt.want) {
  158. t.Errorf("GetSubList() got = %v, want %v", got, tt.want)
  159. }
  160. })
  161. }
  162. }
  163. func TestGetSubScribeInfoLogic_GetSubScribeInfo(t *testing.T) {
  164. type fields struct {
  165. ctx context.Context
  166. svcCtx *svc.ServiceContext
  167. Logger logx.Logger
  168. }
  169. type args struct {
  170. in *bxsubscribe.UserReq
  171. }
  172. tests := []struct {
  173. name string
  174. fields fields
  175. args args
  176. want *bxsubscribe.UserResq
  177. wantErr bool
  178. }{
  179. // TODO: Add test cases.
  180. }
  181. for _, tt := range tests {
  182. t.Run(tt.name, func(t *testing.T) {
  183. l := &GetSubScribeInfoLogic{
  184. ctx: tt.fields.ctx,
  185. svcCtx: tt.fields.svcCtx,
  186. Logger: tt.fields.Logger,
  187. }
  188. got, err := l.GetSubScribeInfo(tt.args.in)
  189. if (err != nil) != tt.wantErr {
  190. t.Errorf("GetSubScribeInfo() error = %v, wantErr %v", err, tt.wantErr)
  191. return
  192. }
  193. if !reflect.DeepEqual(got, tt.want) {
  194. t.Errorf("GetSubScribeInfo() got = %v, want %v", got, tt.want)
  195. }
  196. })
  197. }
  198. }
  199. func TestGetSubScribeInfoLogic_formatItems(t *testing.T) {
  200. type fields struct {
  201. ctx context.Context
  202. svcCtx *svc.ServiceContext
  203. Logger logx.Logger
  204. }
  205. type args struct {
  206. m []map[string]interface{}
  207. }
  208. tests := []struct {
  209. name string
  210. fields fields
  211. args args
  212. want []*bxsubscribe.Items
  213. }{
  214. // TODO: Add test cases.
  215. }
  216. for _, tt := range tests {
  217. t.Run(tt.name, func(t *testing.T) {
  218. l := &GetSubScribeInfoLogic{
  219. ctx: tt.fields.ctx,
  220. svcCtx: tt.fields.svcCtx,
  221. Logger: tt.fields.Logger,
  222. }
  223. if got := l.formatItems(tt.args.m); !reflect.DeepEqual(got, tt.want) {
  224. t.Errorf("formatItems() = %v, want %v", got, tt.want)
  225. }
  226. })
  227. }
  228. }
  229. func TestGetSubScribeInfoLogic_formatM(t *testing.T) {
  230. type fields struct {
  231. ctx context.Context
  232. svcCtx *svc.ServiceContext
  233. Logger logx.Logger
  234. }
  235. type args struct {
  236. m *map[string]interface{}
  237. }
  238. tests := []struct {
  239. name string
  240. fields fields
  241. args args
  242. want map[string]*bxsubscribe.List
  243. }{
  244. // TODO: Add test cases.
  245. }
  246. for _, tt := range tests {
  247. t.Run(tt.name, func(t *testing.T) {
  248. l := &GetSubScribeInfoLogic{
  249. ctx: tt.fields.ctx,
  250. svcCtx: tt.fields.svcCtx,
  251. Logger: tt.fields.Logger,
  252. }
  253. if got := l.formatM(tt.args.m); !reflect.DeepEqual(got, tt.want) {
  254. t.Errorf("formatM() = %v, want %v", got, tt.want)
  255. }
  256. })
  257. }
  258. }
  259. func TestGetSubSomeInfoLogic_GetSubSomeInfo(t *testing.T) {
  260. type fields struct {
  261. ctx context.Context
  262. svcCtx *svc.ServiceContext
  263. Logger logx.Logger
  264. }
  265. type args struct {
  266. in *bxsubscribe.SomeInfoReq
  267. }
  268. tests := []struct {
  269. name string
  270. fields fields
  271. args args
  272. want *bxsubscribe.SomeInfoResp
  273. wantErr bool
  274. }{
  275. // TODO: Add test cases.
  276. }
  277. for _, tt := range tests {
  278. t.Run(tt.name, func(t *testing.T) {
  279. l := &GetSubSomeInfoLogic{
  280. ctx: tt.fields.ctx,
  281. svcCtx: tt.fields.svcCtx,
  282. Logger: tt.fields.Logger,
  283. }
  284. got, err := l.GetSubSomeInfo(tt.args.in)
  285. if (err != nil) != tt.wantErr {
  286. t.Errorf("GetSubSomeInfo() error = %v, wantErr %v", err, tt.wantErr)
  287. return
  288. }
  289. if !reflect.DeepEqual(got, tt.want) {
  290. t.Errorf("GetSubSomeInfo() got = %v, want %v", got, tt.want)
  291. }
  292. })
  293. }
  294. }
  295. func TestGetViewStatusLogic_GetViewStatus(t *testing.T) {
  296. type fields struct {
  297. ctx context.Context
  298. svcCtx *svc.ServiceContext
  299. Logger logx.Logger
  300. }
  301. type args struct {
  302. in *bxsubscribe.GetViewStatusReq
  303. }
  304. tests := []struct {
  305. name string
  306. fields fields
  307. args args
  308. want *bxsubscribe.ViewStatusResp
  309. wantErr bool
  310. }{
  311. // TODO: Add test cases.
  312. }
  313. for _, tt := range tests {
  314. t.Run(tt.name, func(t *testing.T) {
  315. l := &GetViewStatusLogic{
  316. ctx: tt.fields.ctx,
  317. svcCtx: tt.fields.svcCtx,
  318. Logger: tt.fields.Logger,
  319. }
  320. got, err := l.GetViewStatus(tt.args.in)
  321. if (err != nil) != tt.wantErr {
  322. t.Errorf("GetViewStatus() error = %v, wantErr %v", err, tt.wantErr)
  323. return
  324. }
  325. if !reflect.DeepEqual(got, tt.want) {
  326. t.Errorf("GetViewStatus() got = %v, want %v", got, tt.want)
  327. }
  328. })
  329. }
  330. }
  331. func TestMsgDistributorLogic_MsgDistributor(t *testing.T) {
  332. type fields struct {
  333. ctx context.Context
  334. svcCtx *svc.ServiceContext
  335. Logger logx.Logger
  336. }
  337. type args struct {
  338. in *bxsubscribe.MsgDistributorReq
  339. }
  340. tests := []struct {
  341. name string
  342. fields fields
  343. args args
  344. want *bxsubscribe.StatusResp
  345. wantErr bool
  346. }{
  347. // TODO: Add test cases.
  348. }
  349. for _, tt := range tests {
  350. t.Run(tt.name, func(t *testing.T) {
  351. l := &MsgDistributorLogic{
  352. ctx: tt.fields.ctx,
  353. svcCtx: tt.fields.svcCtx,
  354. Logger: tt.fields.Logger,
  355. }
  356. got, err := l.MsgDistributor(tt.args.in)
  357. if (err != nil) != tt.wantErr {
  358. t.Errorf("MsgDistributor() error = %v, wantErr %v", err, tt.wantErr)
  359. return
  360. }
  361. if !reflect.DeepEqual(got, tt.want) {
  362. t.Errorf("MsgDistributor() got = %v, want %v", got, tt.want)
  363. }
  364. })
  365. }
  366. }
  367. func TestNewByPushHistoryLogic(t *testing.T) {
  368. type args struct {
  369. ctx context.Context
  370. svcCtx *svc.ServiceContext
  371. }
  372. tests := []struct {
  373. name string
  374. args args
  375. want *ByPushHistoryLogic
  376. }{
  377. // TODO: Add test cases.
  378. }
  379. for _, tt := range tests {
  380. t.Run(tt.name, func(t *testing.T) {
  381. if got := NewByPushHistoryLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  382. t.Errorf("NewByPushHistoryLogic() = %v, want %v", got, tt.want)
  383. }
  384. })
  385. }
  386. }
  387. func TestNewGetDistributorLogic(t *testing.T) {
  388. type args struct {
  389. ctx context.Context
  390. svcCtx *svc.ServiceContext
  391. }
  392. tests := []struct {
  393. name string
  394. args args
  395. want *GetDistributorLogic
  396. }{
  397. // TODO: Add test cases.
  398. }
  399. for _, tt := range tests {
  400. t.Run(tt.name, func(t *testing.T) {
  401. if got := NewGetDistributorLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  402. t.Errorf("NewGetDistributorLogic() = %v, want %v", got, tt.want)
  403. }
  404. })
  405. }
  406. }
  407. func TestNewGetKeyLogic(t *testing.T) {
  408. type args struct {
  409. ctx context.Context
  410. svcCtx *svc.ServiceContext
  411. }
  412. tests := []struct {
  413. name string
  414. args args
  415. want *GetKeyLogic
  416. }{
  417. // TODO: Add test cases.
  418. }
  419. for _, tt := range tests {
  420. t.Run(tt.name, func(t *testing.T) {
  421. if got := NewGetKeyLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  422. t.Errorf("NewGetKeyLogic() = %v, want %v", got, tt.want)
  423. }
  424. })
  425. }
  426. }
  427. func TestNewGetSubListLogic(t *testing.T) {
  428. type args struct {
  429. ctx context.Context
  430. svcCtx *svc.ServiceContext
  431. }
  432. tests := []struct {
  433. name string
  434. args args
  435. want *GetSubListLogic
  436. }{
  437. // TODO: Add test cases.
  438. }
  439. for _, tt := range tests {
  440. t.Run(tt.name, func(t *testing.T) {
  441. if got := NewGetSubListLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  442. t.Errorf("NewGetSubListLogic() = %v, want %v", got, tt.want)
  443. }
  444. })
  445. }
  446. }
  447. func TestNewGetSubScribeInfoLogic(t *testing.T) {
  448. type args struct {
  449. ctx context.Context
  450. svcCtx *svc.ServiceContext
  451. }
  452. tests := []struct {
  453. name string
  454. args args
  455. want *GetSubScribeInfoLogic
  456. }{
  457. // TODO: Add test cases.
  458. }
  459. for _, tt := range tests {
  460. t.Run(tt.name, func(t *testing.T) {
  461. if got := NewGetSubScribeInfoLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  462. t.Errorf("NewGetSubScribeInfoLogic() = %v, want %v", got, tt.want)
  463. }
  464. })
  465. }
  466. }
  467. func TestNewGetSubSomeInfoLogic(t *testing.T) {
  468. type args struct {
  469. ctx context.Context
  470. svcCtx *svc.ServiceContext
  471. }
  472. tests := []struct {
  473. name string
  474. args args
  475. want *GetSubSomeInfoLogic
  476. }{
  477. // TODO: Add test cases.
  478. }
  479. for _, tt := range tests {
  480. t.Run(tt.name, func(t *testing.T) {
  481. if got := NewGetSubSomeInfoLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  482. t.Errorf("NewGetSubSomeInfoLogic() = %v, want %v", got, tt.want)
  483. }
  484. })
  485. }
  486. }
  487. func TestNewGetViewStatusLogic(t *testing.T) {
  488. type args struct {
  489. ctx context.Context
  490. svcCtx *svc.ServiceContext
  491. }
  492. tests := []struct {
  493. name string
  494. args args
  495. want *GetViewStatusLogic
  496. }{
  497. // TODO: Add test cases.
  498. }
  499. for _, tt := range tests {
  500. t.Run(tt.name, func(t *testing.T) {
  501. if got := NewGetViewStatusLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  502. t.Errorf("NewGetViewStatusLogic() = %v, want %v", got, tt.want)
  503. }
  504. })
  505. }
  506. }
  507. func TestNewMsgDistributorLogic(t *testing.T) {
  508. type args struct {
  509. ctx context.Context
  510. svcCtx *svc.ServiceContext
  511. }
  512. tests := []struct {
  513. name string
  514. args args
  515. want *MsgDistributorLogic
  516. }{
  517. // TODO: Add test cases.
  518. }
  519. for _, tt := range tests {
  520. t.Run(tt.name, func(t *testing.T) {
  521. if got := NewMsgDistributorLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  522. t.Errorf("NewMsgDistributorLogic() = %v, want %v", got, tt.want)
  523. }
  524. })
  525. }
  526. }
  527. func TestNewSetReadLogic(t *testing.T) {
  528. type args struct {
  529. ctx context.Context
  530. svcCtx *svc.ServiceContext
  531. }
  532. tests := []struct {
  533. name string
  534. args args
  535. want *SetReadLogic
  536. }{
  537. // TODO: Add test cases.
  538. }
  539. for _, tt := range tests {
  540. t.Run(tt.name, func(t *testing.T) {
  541. if got := NewSetReadLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  542. t.Errorf("NewSetReadLogic() = %v, want %v", got, tt.want)
  543. }
  544. })
  545. }
  546. }
  547. func TestNewUpdateSubScribeInfoLogic(t *testing.T) {
  548. type args struct {
  549. ctx context.Context
  550. svcCtx *svc.ServiceContext
  551. }
  552. tests := []struct {
  553. name string
  554. args args
  555. want *UpdateSubScribeInfoLogic
  556. }{
  557. // TODO: Add test cases.
  558. }
  559. for _, tt := range tests {
  560. t.Run(tt.name, func(t *testing.T) {
  561. if got := NewUpdateSubScribeInfoLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
  562. t.Errorf("NewUpdateSubScribeInfoLogic() = %v, want %v", got, tt.want)
  563. }
  564. })
  565. }
  566. }
  567. func TestReverse(t *testing.T) {
  568. type args struct {
  569. arr *[]*bxsubscribe.UserStatus
  570. }
  571. tests := []struct {
  572. name string
  573. args args
  574. }{
  575. // TODO: Add test cases.
  576. }
  577. for _, tt := range tests {
  578. t.Run(tt.name, func(t *testing.T) {
  579. })
  580. }
  581. }
  582. func TestSetReadLogic_SetRead(t *testing.T) {
  583. type fields struct {
  584. ctx context.Context
  585. svcCtx *svc.ServiceContext
  586. Logger logx.Logger
  587. }
  588. type args struct {
  589. in *bxsubscribe.SetReadReq
  590. }
  591. tests := []struct {
  592. name string
  593. fields fields
  594. args args
  595. want *bxsubscribe.StatusResp
  596. wantErr bool
  597. }{
  598. // TODO: Add test cases.
  599. }
  600. for _, tt := range tests {
  601. t.Run(tt.name, func(t *testing.T) {
  602. l := &SetReadLogic{
  603. ctx: tt.fields.ctx,
  604. svcCtx: tt.fields.svcCtx,
  605. Logger: tt.fields.Logger,
  606. }
  607. got, err := l.SetRead(tt.args.in)
  608. if (err != nil) != tt.wantErr {
  609. t.Errorf("SetRead() error = %v, wantErr %v", err, tt.wantErr)
  610. return
  611. }
  612. if !reflect.DeepEqual(got, tt.want) {
  613. t.Errorf("SetRead() got = %v, want %v", got, tt.want)
  614. }
  615. })
  616. }
  617. }
  618. func TestUpdateSubScribeInfoLogic_UpdateSubScribeInfo(t *testing.T) {
  619. type fields struct {
  620. ctx context.Context
  621. svcCtx *svc.ServiceContext
  622. Logger logx.Logger
  623. }
  624. type args struct {
  625. in *bxsubscribe.UpdateSubScribeInfoReq
  626. }
  627. tests := []struct {
  628. name string
  629. fields fields
  630. args args
  631. want *bxsubscribe.StatusResp
  632. wantErr bool
  633. }{
  634. // TODO: Add test cases.
  635. }
  636. for _, tt := range tests {
  637. t.Run(tt.name, func(t *testing.T) {
  638. l := &UpdateSubScribeInfoLogic{
  639. ctx: tt.fields.ctx,
  640. svcCtx: tt.fields.svcCtx,
  641. Logger: tt.fields.Logger,
  642. }
  643. got, err := l.UpdateSubScribeInfo(tt.args.in)
  644. if (err != nil) != tt.wantErr {
  645. t.Errorf("UpdateSubScribeInfo() error = %v, wantErr %v", err, tt.wantErr)
  646. return
  647. }
  648. if !reflect.DeepEqual(got, tt.want) {
  649. t.Errorf("UpdateSubScribeInfo() got = %v, want %v", got, tt.want)
  650. }
  651. })
  652. }
  653. }