topic_test.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package service
  2. import (
  3. "context"
  4. "go-common/library/ecode"
  5. "testing"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func Test_FavTopics(t *testing.T) {
  9. Convey("FavTopics", t, func() {
  10. var (
  11. mid int64 = 88888894
  12. pn = 1
  13. ps = 30
  14. )
  15. res, err := s.FavTopics(context.TODO(), mid, pn, ps, nil)
  16. t.Logf("res:%v", res)
  17. So(err, ShouldBeNil)
  18. So(res, ShouldNotBeNil)
  19. })
  20. }
  21. func Test_IsTopicFavoured(t *testing.T) {
  22. Convey("IsTopicFavoured", t, func() {
  23. var (
  24. mid int64 = 88888894
  25. tpID int64 = 3456
  26. )
  27. res, err := s.IsTopicFavoured(context.TODO(), mid, tpID)
  28. t.Logf("res:%v", res)
  29. So(err, ShouldBeNil)
  30. So(res, ShouldNotBeNil)
  31. })
  32. }
  33. func Test_AddFavTopic(t *testing.T) {
  34. Convey("AddFavTopic", t, func() {
  35. var (
  36. mid int64 = 88888894
  37. tpID int64 = 3456
  38. ck, ak string
  39. )
  40. err := s.AddFavTopic(context.TODO(), mid, tpID, ck, ak)
  41. t.Logf("err:%v", err)
  42. So(err, ShouldEqual, ecode.FavTopicExist)
  43. })
  44. }
  45. func Test_DelFavTopic(t *testing.T) {
  46. Convey("DelFavTopic", t, func() {
  47. var (
  48. mid int64 = 88888894
  49. tpID int64 = 3457
  50. )
  51. err := s.DelFavTopic(context.TODO(), mid, tpID)
  52. t.Logf("err:%v", err)
  53. So(err, ShouldEqual, ecode.FavVideoAlreadyDel)
  54. })
  55. }