load_upper_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package upper
  2. import (
  3. "context"
  4. "testing"
  5. ugcMdl "go-common/app/job/main/tv/model/ugc"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestUpperupperMetaKey(t *testing.T) {
  9. var MID = int64(0)
  10. convey.Convey("upperMetaKey", t, func(c convey.C) {
  11. p1 := upperMetaKey(MID)
  12. c.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  13. ctx.So(p1, convey.ShouldNotBeNil)
  14. })
  15. })
  16. }
  17. func TestUpperLoadUpMeta(t *testing.T) {
  18. var (
  19. ctx = context.Background()
  20. mid = int64(0)
  21. )
  22. convey.Convey("LoadUpMeta", t, func(c convey.C) {
  23. upper, err := d.LoadUpMeta(ctx, mid)
  24. c.Convey("Then err should be nil.upper should not be nil.", func(ctx convey.C) {
  25. ctx.So(err, convey.ShouldBeNil)
  26. ctx.So(upper, convey.ShouldNotBeNil)
  27. })
  28. })
  29. }
  30. func TestUpperupMetaCache(t *testing.T) {
  31. var (
  32. c = context.Background()
  33. mid = int64(0)
  34. )
  35. convey.Convey("upMetaCache", t, func(ctx convey.C) {
  36. upper, err := d.upMetaCache(c, mid)
  37. ctx.Convey("Then err should be nil.upper should not be nil.", func(ctx convey.C) {
  38. ctx.So(err, convey.ShouldBeNil)
  39. ctx.So(upper, convey.ShouldNotBeNil)
  40. })
  41. })
  42. }
  43. func TestUpperupMetaDB(t *testing.T) {
  44. var (
  45. c = context.Background()
  46. mid = int64(0)
  47. )
  48. convey.Convey("upMetaDB", t, func(ctx convey.C) {
  49. upper, err := d.upMetaDB(c, mid)
  50. ctx.Convey("Then err should be nil.upper should not be nil.", func(ctx convey.C) {
  51. ctx.So(err, convey.ShouldBeNil)
  52. ctx.So(upper, convey.ShouldNotBeNil)
  53. })
  54. })
  55. }
  56. func TestUpperaddUpMetaCache(t *testing.T) {
  57. var (
  58. upper = &ugcMdl.Upper{}
  59. )
  60. convey.Convey("addUpMetaCache", t, func(ctx convey.C) {
  61. err := d.addUpMetaCache(context.Background(), upper)
  62. ctx.Convey("Then err should be nil.upper should not be nil.", func(ctx convey.C) {
  63. ctx.So(err, convey.ShouldBeNil)
  64. })
  65. })
  66. }