admin_test.go 819 B

12345678910111213141516171819202122232425262728293031323334
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/admin/main/reply/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestAdminLog(t *testing.T) {
  10. var (
  11. oids = []int64{1, 2, 3}
  12. rpIDs = []int64{10, 20, 30}
  13. adminID = int64(100)
  14. typ = int32(1)
  15. c = context.Background()
  16. now = time.Now()
  17. )
  18. Convey("add admin log", t, WithDao(func(d *Dao) {
  19. rows, err := d.AddAdminLog(c, oids, rpIDs, adminID, typ, model.AdminIsNew, model.AdminIsReport, model.AdminOperDelete, "result", "remark", now)
  20. So(err, ShouldBeNil)
  21. So(rows, ShouldNotEqual, 0)
  22. t.Log(rows)
  23. rows, err = d.UpAdminNotNew(c, rpIDs, now)
  24. So(err, ShouldBeNil)
  25. So(rows, ShouldNotEqual, 0)
  26. res, err := d.AdminLogsByRpID(c, rpIDs[0])
  27. So(err, ShouldBeNil)
  28. So(len(res), ShouldNotEqual, 0)
  29. }))
  30. }