relation_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package relation
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. . "github.com/smartystreets/goconvey/convey"
  9. "go-common/app/interface/main/app-interface/conf"
  10. model "go-common/app/interface/main/app-interface/model/relation"
  11. )
  12. var (
  13. s *Service
  14. )
  15. func init() {
  16. dir, _ := filepath.Abs("../../cmd/app-interface-test.toml")
  17. flag.Set("conf", dir)
  18. conf.Init()
  19. s = New(conf.Conf)
  20. time.Sleep(3 * time.Second)
  21. }
  22. func TestService_Followings(t *testing.T) {
  23. type args struct {
  24. c context.Context
  25. vmid int64
  26. mid int64
  27. pn int
  28. ps int
  29. version uint64
  30. order string
  31. }
  32. tests := []struct {
  33. name string
  34. args args
  35. wantF []*model.Following
  36. wantCrc32v uint32
  37. wantTotal int
  38. wantErr error
  39. }{
  40. // TODO: Add test cases.
  41. }
  42. for _, tt := range tests {
  43. Convey(tt.name, t, func() {
  44. gotF, gotCrc32v, gotTotal, err := s.Followings(tt.args.c, tt.args.vmid, tt.args.mid, tt.args.pn, tt.args.ps, tt.args.version, tt.args.order)
  45. So(gotF, ShouldResemble, tt.wantF)
  46. So(gotCrc32v, ShouldResemble, tt.wantCrc32v)
  47. So(gotTotal, ShouldResemble, tt.wantTotal)
  48. So(err, ShouldEqual, tt.wantErr)
  49. })
  50. }
  51. }
  52. func TestService_Tag(t *testing.T) {
  53. type args struct {
  54. c context.Context
  55. mid int64
  56. tid int64
  57. pn int
  58. ps int
  59. }
  60. tests := []struct {
  61. name string
  62. s *Service
  63. args args
  64. wantT []*model.Tag
  65. wantErr error
  66. }{
  67. // TODO: Add test cases.
  68. }
  69. for _, tt := range tests {
  70. t.Run(tt.name, func(t *testing.T) {
  71. gotT, err := tt.s.Tag(tt.args.c, tt.args.mid, tt.args.tid, tt.args.pn, tt.args.ps)
  72. So(gotT, ShouldResemble, tt.wantT)
  73. So(err, ShouldEqual, tt.wantErr)
  74. })
  75. }
  76. }