http_test.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package block
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoSendSysMsg(t *testing.T) {
  8. convey.Convey("SendSysMsg", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. mids = []int64{1, 2, 3}
  12. content = "账号违规处理通知-test-content"
  13. remoteIP = "127.0.0.1"
  14. code = "2_3_2"
  15. title = "账号违规处理通知-test"
  16. )
  17. ctx.Convey("When everything right", func(ctx convey.C) {
  18. err := d.SendSysMsg(c, code, mids, title, content, remoteIP)
  19. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  20. ctx.So(err, convey.ShouldBeNil)
  21. })
  22. })
  23. })
  24. }
  25. func TestDaomidsToParam(t *testing.T) {
  26. convey.Convey("midsToParam", t, func(ctx convey.C) {
  27. var (
  28. mids = []int64{46333, 35858}
  29. )
  30. ctx.Convey("When everything right", func(ctx convey.C) {
  31. str := midsToParam(mids)
  32. ctx.Convey("Then str should equal mids[0],mids[1],....", func(ctx convey.C) {
  33. ctx.So(str, convey.ShouldEqual, "46333,35858")
  34. })
  35. })
  36. })
  37. }