panel_test.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package dao
  2. import (
  3. "testing"
  4. "go-common/app/admin/main/tv/model"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoSavePanel(t *testing.T) {
  8. convey.Convey("SavePanel", t, func(ctx convey.C) {
  9. var (
  10. panel = &model.TvPriceConfig{ID: 100000000}
  11. )
  12. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  13. err := d.SavePanel(panel)
  14. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestDaoGetById(t *testing.T) {
  21. convey.Convey("GetById", t, func(ctx convey.C) {
  22. var (
  23. id = int64(100000000)
  24. )
  25. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  26. panelInfo, err := d.GetById(id)
  27. ctx.Convey("Then err should be nil.panelInfo should not be nil.", func(ctx convey.C) {
  28. ctx.So(err, convey.ShouldBeNil)
  29. ctx.So(panelInfo, convey.ShouldNotBeNil)
  30. })
  31. })
  32. })
  33. }
  34. func TestDaoPanelStatus(t *testing.T) {
  35. convey.Convey("PanelStatus", t, func(ctx convey.C) {
  36. var (
  37. id = int64(100000000)
  38. status = int64(2)
  39. )
  40. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  41. err := d.PanelStatus(id, status)
  42. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. })
  45. })
  46. })
  47. }
  48. func TestDaoExistProduct(t *testing.T) {
  49. convey.Convey("ExistProduct", t, func(ctx convey.C) {
  50. var (
  51. productID = ""
  52. )
  53. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  54. flag := d.ExistProduct(productID)
  55. ctx.Convey("Then flag should not be nil.", func(ctx convey.C) {
  56. ctx.So(flag, convey.ShouldNotBeNil)
  57. })
  58. })
  59. })
  60. }