task_config_test.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package gorm
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/aegis/model/task"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoQueryConfigs(t *testing.T) {
  9. convey.Convey("QueryConfigs", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. params = &task.QueryParams{
  13. BusinessID: 1,
  14. FlowID: 1,
  15. Btime: "0000-00-00 00:00:00",
  16. Etime: "2018-12-12 12:12:12",
  17. ConfName: "mid",
  18. }
  19. )
  20. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  21. _, _, err := d.QueryConfigs(c, params)
  22. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  23. ctx.So(err, convey.ShouldBeNil)
  24. })
  25. })
  26. })
  27. }
  28. func TestDaoDeleteConfig(t *testing.T) {
  29. convey.Convey("DeleteConfig", t, func(ctx convey.C) {
  30. var (
  31. c = context.Background()
  32. )
  33. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  34. err := d.DeleteConfig(c, 0)
  35. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  36. ctx.So(err, convey.ShouldBeNil)
  37. })
  38. })
  39. })
  40. }
  41. func TestDaoSetStateConfig(t *testing.T) {
  42. convey.Convey("SetStateConfig", t, func(ctx convey.C) {
  43. var (
  44. c = context.Background()
  45. )
  46. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  47. err := d.SetStateConfig(c, 0, 0)
  48. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  49. ctx.So(err, convey.ShouldBeNil)
  50. })
  51. })
  52. })
  53. }
  54. func TestDaoUpdateConfig(t *testing.T) {
  55. convey.Convey("UpdateConfig", t, func(ctx convey.C) {
  56. var (
  57. config = &task.Config{}
  58. )
  59. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  60. err := d.UpdateConfig(cntx, config)
  61. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  62. ctx.So(err, convey.ShouldBeNil)
  63. })
  64. })
  65. })
  66. }