old_order_test.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/service/main/vip/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoAddOldPayOrder(t *testing.T) {
  9. convey.Convey("AddOldPayOrder", t, func(convCtx convey.C) {
  10. var (
  11. c = context.Background()
  12. orderNo = "20188888888"
  13. r = &model.VipOldPayOrder{
  14. OrderNo: orderNo,
  15. UserIP: []byte("127.0.0.1"),
  16. }
  17. )
  18. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  19. err := d.AddOldPayOrder(c, r)
  20. convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
  21. convCtx.So(err, convey.ShouldBeNil)
  22. })
  23. })
  24. convCtx.Convey("clean data", func(convCtx convey.C) {
  25. d.olddb.Exec(c, "delete from vip_pay_order where order_no=? ", orderNo)
  26. })
  27. })
  28. }
  29. func TestDaoAddOldRechargeOrder(t *testing.T) {
  30. convey.Convey("AddOldRechargeOrder", t, func(convCtx convey.C) {
  31. var (
  32. c = context.Background()
  33. orderNo = "201899999999"
  34. r = &model.VipOldRechargeOrder{OrderNo: orderNo}
  35. )
  36. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  37. err := d.AddOldRechargeOrder(c, r)
  38. convCtx.So(err, convey.ShouldBeNil)
  39. })
  40. convCtx.Convey("clean data", func(convCtx convey.C) {
  41. d.olddb.Exec(c, "delete from vip_recharge_order where order_no=? ", orderNo)
  42. })
  43. })
  44. }