modules_test.go 894 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package dao
  2. import (
  3. "go-common/app/admin/main/tv/model"
  4. "testing"
  5. "time"
  6. "context"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestDaoSetModulePublishCache(t *testing.T) {
  10. var (
  11. c = context.Background()
  12. pageID = "18"
  13. p = model.ModPub{
  14. Time: time.Now().Format("2006-01-02 15:04:05"),
  15. State: 1,
  16. }
  17. )
  18. convey.Convey("SetModPub", t, func(ctx convey.C) {
  19. err := d.SetModPub(c, pageID, p)
  20. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  21. ctx.So(err, convey.ShouldBeNil)
  22. })
  23. })
  24. }
  25. func TestDaoGetModulePublishCache(t *testing.T) {
  26. var (
  27. c = context.Background()
  28. pageID = "18"
  29. )
  30. convey.Convey("GetModPub", t, func(ctx convey.C) {
  31. p, err := d.GetModPub(c, pageID)
  32. ctx.Convey("Then err should be nil.p should not be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. ctx.So(p, convey.ShouldNotBeNil)
  35. })
  36. })
  37. }