action_test.go 798 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "testing"
  6. "time"
  7. "go-common/app/job/main/dm2/model"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestActionAddDM(t *testing.T) {
  11. id := int64(time.Now().UnixNano())
  12. dm := &model.DM{
  13. ID: id,
  14. Type: 1,
  15. Oid: 1221,
  16. Mid: 4780461,
  17. Progress: 111,
  18. State: 0,
  19. Pool: 0,
  20. Ctime: 1533804859,
  21. Content: &model.Content{
  22. ID: id,
  23. Mode: 4,
  24. IP: 123,
  25. FontSize: 25,
  26. Color: 12345,
  27. Msg: "testtddddddddddddd",
  28. Ctime: 1533804859,
  29. },
  30. }
  31. Convey("", t, func() {
  32. data, err := json.Marshal(dm)
  33. So(err, ShouldBeNil)
  34. act := &model.Action{
  35. Action: model.ActAddDM,
  36. Data: data,
  37. }
  38. err = svr.actionAct(context.TODO(), act)
  39. So(err, ShouldBeNil)
  40. })
  41. }