search_con_test.go 866 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package ugc
  2. import (
  3. "fmt"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDao_UgcCont(t *testing.T) {
  8. Convey("TestDao_UgcCont", t, WithDao(func(d *Dao) {
  9. var aid int
  10. d.DB.QueryRow(ctx, queryAid).Scan(&aid)
  11. if aid == 0 {
  12. fmt.Println("No ready audit Data")
  13. return
  14. }
  15. if res, maxID, err := d.UgcCont(ctx, aid, 50); err != nil {
  16. fmt.Println(err)
  17. So(len(res), ShouldEqual, 0)
  18. So(maxID, ShouldBeZeroValue)
  19. } else {
  20. So(len(res), ShouldBeGreaterThan, 0)
  21. for _, v := range res {
  22. fmt.Println(v)
  23. }
  24. So(maxID, ShouldBeGreaterThan, 0)
  25. }
  26. }))
  27. }
  28. func TestDao_UgcContCount(t *testing.T) {
  29. Convey("TestDao_UgcContCount", t, WithDao(func(d *Dao) {
  30. var aid int
  31. d.DB.QueryRow(ctx, queryAid).Scan(&aid)
  32. if aid != 0 {
  33. res, _ := d.UgcCnt(ctx)
  34. So(res, ShouldBeGreaterThan, 0)
  35. fmt.Println(res)
  36. }
  37. }))
  38. }