databus_test.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaonotifyKey(t *testing.T) {
  8. var (
  9. mid = int64(4780461)
  10. )
  11. convey.Convey("notifyKey", t, func(ctx convey.C) {
  12. p1 := notifyKey(mid)
  13. ctx.Convey("p1 should not be nil", func(ctx convey.C) {
  14. ctx.So(p1, convey.ShouldNotBeNil)
  15. })
  16. })
  17. }
  18. func TestDaoAddExplog(t *testing.T) {
  19. var (
  20. c = context.Background()
  21. mid = int64(0)
  22. exp = int64(0)
  23. toExp = int64(0)
  24. oper = ""
  25. reason = ""
  26. ip = ""
  27. )
  28. convey.Convey("AddExplog", t, func(ctx convey.C) {
  29. err := d.AddExplog(c, mid, exp, toExp, oper, reason, ip)
  30. ctx.Convey("Error should be nil", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. })
  33. })
  34. }
  35. func TestDaoNotifyPurgeCache(t *testing.T) {
  36. var (
  37. c = context.Background()
  38. mid = int64(0)
  39. action = ""
  40. )
  41. convey.Convey("NotifyPurgeCache", t, func(ctx convey.C) {
  42. p1 := d.NotifyPurgeCache(c, mid, action)
  43. ctx.Convey("Error should be nil", func(ctx convey.C) {
  44. ctx.So(p1, convey.ShouldBeNil)
  45. })
  46. })
  47. }