search_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoOutTime(t *testing.T) {
  8. convey.Convey("OutTime", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. ids = []int64{}
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. httpMock("GET", d.c.Host.Search+_searchURL).Reply(200).JSON(`{"code":0,"data":{"result":[{"uid":0}]}}`)
  15. mcases, err := d.OutTime(c, ids)
  16. ctx.Convey("Then err should be nil.mcases should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(mcases, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoInQuitList(t *testing.T) {
  24. convey.Convey("InQuitList", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. uids = []int64{}
  28. bt = ""
  29. et = ""
  30. )
  31. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  32. httpMock("GET", d.c.Host.Search+_searchURL).Reply(200).JSON(`{"code":0,"data":{"result":[{"uid":0,"action":"0"}]}}`)
  33. l, err := d.InQuitList(c, uids, bt, et)
  34. ctx.Convey("Then err should be nil.l should not be nil.", func(ctx convey.C) {
  35. ctx.So(err, convey.ShouldBeNil)
  36. ctx.So(l, convey.ShouldNotBeNil)
  37. })
  38. })
  39. })
  40. }