mysql_mail_log_test.go 832 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package dao
  2. import (
  3. "go-common/app/admin/ep/merlin/model"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. var (
  8. username = "fengyifenguitest@bilibili.com"
  9. )
  10. func Test_Mail_Log(t *testing.T) {
  11. Convey("test add mail log", t, func() {
  12. ml := &model.MailLog{
  13. ReceiverName: username,
  14. MailType: 1,
  15. SendContext: "test add mail log",
  16. }
  17. err := d.InsertMailLog(ml)
  18. So(err, ShouldBeNil)
  19. })
  20. Convey("test find mail log", t, func() {
  21. mailLogs, err := d.FindMailLog(username)
  22. So(len(mailLogs), ShouldBeGreaterThan, 0)
  23. So(err, ShouldBeNil)
  24. })
  25. Convey("test delete mail log", t, func() {
  26. err := d.DelMailLog(username)
  27. So(err, ShouldBeNil)
  28. })
  29. Convey("test find mail log", t, func() {
  30. mailLogs, err := d.FindMailLog(username)
  31. So(len(mailLogs), ShouldEqual, 0)
  32. So(err, ShouldBeNil)
  33. })
  34. }