associate_old_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoActivityOrder(t *testing.T) {
  8. convey.Convey("ActivityOrder", t, func(convCtx convey.C) {
  9. var (
  10. c = context.Background()
  11. orderNo = "test_activity_no"
  12. )
  13. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  14. _, err := d.ActivityOrder(c, orderNo)
  15. convCtx.So(err, convey.ShouldBeNil)
  16. })
  17. convCtx.Convey("clean data", func(convCtx convey.C) {
  18. d.olddb.Exec(c, "delete from vip_order_activity_record where order_no=? ", orderNo)
  19. })
  20. })
  21. }
  22. func TestDaoUpdateActivityState(t *testing.T) {
  23. convey.Convey("UpdateActivityState", t, func(convCtx convey.C) {
  24. var (
  25. c = context.Background()
  26. state = int8(0)
  27. orderNO = ""
  28. )
  29. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  30. aff, err := d.UpdateActivityState(c, state, orderNO)
  31. convCtx.Convey("Then err should be nil.aff should not be nil.", func(convCtx convey.C) {
  32. convCtx.So(err, convey.ShouldBeNil)
  33. convCtx.So(aff, convey.ShouldNotBeNil)
  34. })
  35. })
  36. })
  37. }
  38. func TestDaoCountProductBuy(t *testing.T) {
  39. convey.Convey("CountProductBuy", t, func(convCtx convey.C) {
  40. var (
  41. c = context.Background()
  42. mid = int64(0)
  43. months = int32(0)
  44. panelType = ""
  45. )
  46. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  47. count, err := d.CountProductBuy(c, mid, months, panelType)
  48. convCtx.Convey("Then err should be nil.count should not be nil.", func(convCtx convey.C) {
  49. convCtx.So(err, convey.ShouldBeNil)
  50. convCtx.So(count, convey.ShouldNotBeNil)
  51. })
  52. })
  53. })
  54. }