auto_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoDoAvBreach(t *testing.T) {
  8. convey.Convey("DoAvBreach", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. mid = int64(10)
  12. aid = int64(100)
  13. ctype = int(1)
  14. reason = "test"
  15. )
  16. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  17. err := d.DoAvBreach(c, mid, aid, ctype, reason)
  18. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  19. ctx.So(err, convey.ShouldNotBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoDoUpForbid(t *testing.T) {
  25. convey.Convey("DoUpForbid", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. mid = int64(10)
  29. days = int(100)
  30. ctype = int(1)
  31. reason = "test"
  32. )
  33. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  34. err := d.DoUpForbid(c, mid, days, ctype, reason)
  35. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  36. ctx.So(err, convey.ShouldNotBeNil)
  37. })
  38. })
  39. })
  40. }
  41. func TestDaoDoUpDismiss(t *testing.T) {
  42. convey.Convey("DoUpDismiss", t, func(ctx convey.C) {
  43. var (
  44. c = context.Background()
  45. mid = int64(100)
  46. ctype = int(1)
  47. reason = "test"
  48. )
  49. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  50. err := d.DoUpDismiss(c, mid, ctype, reason)
  51. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  52. ctx.So(err, convey.ShouldNotBeNil)
  53. })
  54. })
  55. })
  56. }
  57. func TestDaoDoUpPass(t *testing.T) {
  58. convey.Convey("DoUpPass", t, func(ctx convey.C) {
  59. var (
  60. c = context.Background()
  61. mids = []int64{1, 2, 3}
  62. ctype = int(1)
  63. )
  64. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  65. err := d.DoUpPass(c, mids, ctype)
  66. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  67. ctx.So(err, convey.ShouldNotBeNil)
  68. })
  69. })
  70. })
  71. }