blacklist_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package dao
  2. import (
  3. "testing"
  4. "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestDaoBlacklistAdd(t *testing.T) {
  7. convey.Convey("BlacklistAdd", t, func(ctx convey.C) {
  8. var (
  9. mids = []int64{10000, 10001}
  10. )
  11. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  12. err := d.BlacklistAdd(mids, mids)
  13. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  14. ctx.So(err, convey.ShouldBeNil)
  15. })
  16. })
  17. })
  18. }
  19. func TestDaoBlacklistIn(t *testing.T) {
  20. convey.Convey("BlacklistIn", t, func(ctx convey.C) {
  21. var (
  22. mids = []int64{1, 2, 3, 4, 5, 6, 7, 8}
  23. )
  24. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  25. blacklist, err := d.BlacklistIn(mids)
  26. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  27. ctx.So(err, convey.ShouldBeNil)
  28. ctx.So(blacklist, convey.ShouldNotBeNil)
  29. })
  30. })
  31. })
  32. }
  33. func TestDaoBlacklistUp(t *testing.T) {
  34. convey.Convey("BlacklistUp", t, func(ctx convey.C) {
  35. var (
  36. id = int64(1)
  37. status = int(0)
  38. )
  39. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  40. err := d.BlacklistUp(id, status)
  41. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. })
  44. })
  45. })
  46. }
  47. func TestDaoBlacklistIndex(t *testing.T) {
  48. convey.Convey("BlacklistIndex", t, func(ctx convey.C) {
  49. var (
  50. mid = int64(1)
  51. pn = int(1)
  52. ps = int(10)
  53. )
  54. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  55. pager, err := d.BlacklistIndex(mid, pn, ps)
  56. ctx.Convey("Then err should be nil.pager should not be nil.", func(ctx convey.C) {
  57. ctx.So(err, convey.ShouldBeNil)
  58. ctx.So(pager, convey.ShouldNotBeNil)
  59. })
  60. })
  61. })
  62. }