consumer_test.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoTaskUserCheckIn(t *testing.T) {
  8. convey.Convey("TaskUserCheckIn", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. uid = int64(0)
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. rows, err := d.TaskUserCheckIn(c, uid)
  15. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(rows, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestDaoTaskUserCheckOff(t *testing.T) {
  23. convey.Convey("TaskUserCheckOff", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. uid = int64(0)
  27. )
  28. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  29. rows, err := d.TaskUserCheckOff(c, uid)
  30. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. ctx.So(rows, convey.ShouldNotBeNil)
  33. })
  34. })
  35. })
  36. }
  37. func TestDaoConsumers(t *testing.T) {
  38. convey.Convey("Consumers", t, func(ctx convey.C) {
  39. var (
  40. c = context.Background()
  41. )
  42. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  43. cms, err := d.Consumers(c)
  44. ctx.Convey("Then err should be nil.cms should not be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. ctx.So(cms, convey.ShouldNotBeNil)
  47. })
  48. })
  49. })
  50. }
  51. func TestDaoIsConsumerOn(t *testing.T) {
  52. convey.Convey("IsConsumerOn", t, func(ctx convey.C) {
  53. var (
  54. c = context.Background()
  55. uid = int64(0)
  56. )
  57. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  58. state := d.IsConsumerOn(c, uid)
  59. ctx.Convey("Then state should not be nil.", func(ctx convey.C) {
  60. ctx.So(state, convey.ShouldNotBeNil)
  61. })
  62. })
  63. })
  64. }