user_log_test.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/interface/main/dm2/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoReportDmGarbageLog(t *testing.T) {
  9. convey.Convey("ReportDmGarbageLog", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. dm = &model.DM{}
  13. )
  14. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  15. err := testDao.ReportDmGarbageLog(c, dm)
  16. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestDaoReportDmLog(t *testing.T) {
  23. convey.Convey("ReportDmLog", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. dm = &model.DM{}
  27. )
  28. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  29. err := testDao.ReportDmLog(c, dm)
  30. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. })
  33. })
  34. })
  35. }
  36. func TestDaoreportUserLog(t *testing.T) {
  37. convey.Convey("reportUserLog", t, func(ctx convey.C) {
  38. var (
  39. c = context.Background()
  40. dm = &model.DM{}
  41. userLogType = int(0)
  42. userLogAction = ""
  43. )
  44. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  45. err := testDao.reportUserLog(c, dm, userLogType, userLogAction)
  46. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  47. ctx.So(err, convey.ShouldBeNil)
  48. })
  49. })
  50. })
  51. }