transfer_test.go 889 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/dm2/conf"
  6. "go-common/app/job/main/dm2/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestTransfers(t *testing.T) {
  10. var (
  11. d = New(conf.Conf)
  12. c = context.TODO()
  13. )
  14. Convey("test transferJob", t, func() {
  15. _, err := d.Transfers(c, model.StatInit)
  16. So(err, ShouldBeNil)
  17. })
  18. }
  19. func TestDmIndexs(t *testing.T) {
  20. var (
  21. d = New(conf.Conf)
  22. c = context.TODO()
  23. )
  24. Convey("test DmIndexs", t, func() {
  25. _, _, _, err := d.DMIndexs(c, 1, 1012, 0, 10)
  26. So(err, ShouldBeNil)
  27. })
  28. }
  29. func TestUpdateTransfer(t *testing.T) {
  30. var (
  31. d = New(conf.Conf)
  32. c = context.TODO()
  33. trans = &model.Transfer{
  34. ID: 265,
  35. FromCid: 233,
  36. ToCid: 1221,
  37. Dmid: 333,
  38. Mid: 1,
  39. Offset: 0.00,
  40. State: 0,
  41. }
  42. )
  43. Convey("test update job", t, func() {
  44. d.UpdateTransfer(c, trans)
  45. })
  46. }