region_test.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/tv/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoRegList(t *testing.T) {
  9. convey.Convey("RegList", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. arg = &model.Param{PageID: "1"}
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. res, err := d.RegList(c, arg)
  16. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(res, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoAddReg(t *testing.T) {
  24. convey.Convey("AddReg", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. title = "1"
  28. itype = "1"
  29. itid = "1"
  30. rank = "1"
  31. )
  32. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  33. err := d.AddReg(c, title, itype, itid, rank)
  34. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  35. println(err)
  36. })
  37. })
  38. })
  39. }
  40. func TestDaoEditReg(t *testing.T) {
  41. convey.Convey("EditReg", t, func(ctx convey.C) {
  42. var (
  43. c = context.Background()
  44. pid = "1"
  45. title = "1"
  46. itype = "1"
  47. itid = "1"
  48. )
  49. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  50. err := d.EditReg(c, pid, title, itype, itid)
  51. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  52. ctx.So(err, convey.ShouldBeNil)
  53. })
  54. })
  55. })
  56. }
  57. func TestDaoUpState(t *testing.T) {
  58. convey.Convey("UpState", t, func(ctx convey.C) {
  59. var (
  60. c = context.Background()
  61. pids = []int{1}
  62. state = "0"
  63. )
  64. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  65. err := d.UpState(c, pids, state)
  66. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  67. ctx.So(err, convey.ShouldBeNil)
  68. })
  69. })
  70. })
  71. }