search_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/job/main/workflow/model"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestDaoSearchChall(t *testing.T) {
  10. convey.Convey("SearchChall", t, func(ctx convey.C) {
  11. var (
  12. c = context.Background()
  13. params = &model.SearchParams{}
  14. )
  15. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  16. res, err := d.SearchChall(c, params)
  17. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(res, convey.ShouldNotBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoSearchAppeal(t *testing.T) {
  25. convey.Convey("SearchAppeal", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. cond = model.AppealSearchCond{
  29. Fields: []string{"id", "mid"},
  30. Bid: []int{2, 28},
  31. TTimeTo: time.Now().AddDate(0, 0, -3).Format("2006-01-02 15:04:05"),
  32. PS: 1000,
  33. PN: 1,
  34. Order: "id",
  35. Sort: "desc",
  36. }
  37. )
  38. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  39. res, err := d.SearchAppeal(c, cond)
  40. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  41. ctx.So(err, convey.ShouldBeNil)
  42. ctx.So(res, convey.ShouldNotBeNil)
  43. })
  44. })
  45. })
  46. }