mysql_machine_log_test.go 811 B

123456789101112131415161718192021222324252627282930313233343536
  1. package dao
  2. import (
  3. "testing"
  4. "time"
  5. "go-common/app/admin/ep/merlin/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. var (
  9. machineLog = model.MachineLog{
  10. Username: "fengyifeng",
  11. MachineID: 1,
  12. OperateType: "DelTest",
  13. OperateResult: "",
  14. OperateTime: time.Now(),
  15. }
  16. )
  17. func TestInsertMachineLog(t *testing.T) {
  18. Convey("Everything goes well when names is slice with value", t, func() {
  19. err := d.InsertMachineLog(&machineLog)
  20. So(err, ShouldBeNil)
  21. d.db.Where("OperateType=DelTest").Delete(machineLog)
  22. })
  23. }
  24. func TestFindMachineLogsByMachineID(t *testing.T) {
  25. Convey("Everything goes well when names is slice with value", t, func() {
  26. _, _, err := d.FindMachineLogsByMachineID(0, 1, 5)
  27. So(err, ShouldBeNil)
  28. d.db.Where("OperateType=DelTest").Delete(machineLog)
  29. })
  30. }