msg_test.go 696 B

123456789101112131415161718192021222324252627
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. gock "gopkg.in/h2non/gock.v1"
  7. )
  8. func Test_MutliSendSysMsg(t *testing.T) {
  9. Convey("return someting", t, func() {
  10. defer gock.OffAll()
  11. httpMock("POST", d.msgURL).Reply(200).JSON(`{"code":0}`)
  12. err := d.MutliSendSysMsg(context.Background(), []int64{22, 11}, "dasda", "dsadasd", "127.0.0.1")
  13. So(err, ShouldBeNil)
  14. })
  15. }
  16. func Test_SendSysMsg(t *testing.T) {
  17. Convey("return someting", t, func() {
  18. defer gock.OffAll()
  19. httpMock("POST", d.msgURL).Reply(200).JSON(`{"code":0}`)
  20. err := d.SendSysMsg(context.Background(), []int64{22, 11}, "dasda", "dsadasd", "127.0.0.1")
  21. So(err, ShouldBeNil)
  22. })
  23. }