up_bill_test.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoInsertUpBillBatch(t *testing.T) {
  8. convey.Convey("InsertUpBillBatch", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. values = "(1,2,3,4,5,6,7,8,9,'test','test','2018-06-23','2018-06-23','2018-06-23','2018-06-23')"
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. Exec(c, "DELETE FROM up_bill WHERE mid=1")
  15. rows, err := d.InsertUpBillBatch(c, values)
  16. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(rows, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoListUpSignedAvs(t *testing.T) {
  24. convey.Convey("ListUpSignedAvs", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. id = int64(0)
  28. limit = int(10)
  29. )
  30. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  31. ups, last, err := d.ListUpSignedAvs(c, id, limit)
  32. ctx.Convey("Then err should be nil.ups,last should not be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. ctx.So(last, convey.ShouldNotBeNil)
  35. ctx.So(ups, convey.ShouldNotBeNil)
  36. })
  37. })
  38. })
  39. }