unicom_test.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package unicom
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/job/main/app-wall/conf"
  9. "go-common/app/job/main/app-wall/model/unicom"
  10. . "github.com/smartystreets/goconvey/convey"
  11. )
  12. var (
  13. d *Dao
  14. )
  15. func ctx() context.Context {
  16. return context.Background()
  17. }
  18. func init() {
  19. dir, _ := filepath.Abs("../../cmd/app-wall-job-test.toml")
  20. flag.Set("conf", dir)
  21. conf.Init()
  22. d = New(conf.Conf)
  23. time.Sleep(time.Second)
  24. }
  25. func TestUpUserIntegral(t *testing.T) {
  26. Convey("UpUserIntegral", t, func() {
  27. res, err := d.UpUserIntegral(ctx(), &unicom.UserBind{})
  28. So(err, ShouldBeNil)
  29. So(res, ShouldNotBeEmpty)
  30. })
  31. }
  32. func TestOrdersUserFlow(t *testing.T) {
  33. Convey("OrdersUserFlow", t, func() {
  34. res, err := d.OrdersUserFlow(ctx(), "")
  35. So(err, ShouldBeNil)
  36. So(res, ShouldNotBeEmpty)
  37. })
  38. }
  39. func TestBindAll(t *testing.T) {
  40. Convey("BindAll", t, func() {
  41. res, err := d.BindAll(ctx(), 1, 1)
  42. So(err, ShouldBeNil)
  43. So(res, ShouldNotBeEmpty)
  44. })
  45. }
  46. func TestUserBind(t *testing.T) {
  47. Convey("UserBind", t, func() {
  48. res, err := d.UserBind(ctx(), 1)
  49. So(err, ShouldBeNil)
  50. So(res, ShouldNotBeEmpty)
  51. })
  52. }
  53. func TestIPSync(t *testing.T) {
  54. Convey("IPSync", t, func() {
  55. res, err := d.IPSync(ctx())
  56. So(err, ShouldBeNil)
  57. So(res, ShouldNotBeEmpty)
  58. })
  59. }
  60. func TestInUserPackLog(t *testing.T) {
  61. Convey("InUserPackLog", t, func() {
  62. res, err := d.InUserPackLog(ctx(), nil)
  63. So(err, ShouldBeNil)
  64. So(res, ShouldNotBeEmpty)
  65. })
  66. }
  67. func TestInUserIntegralLog(t *testing.T) {
  68. Convey("InUserIntegralLog", t, func() {
  69. res, err := d.InUserIntegralLog(ctx(), nil)
  70. So(err, ShouldBeNil)
  71. So(res, ShouldNotBeEmpty)
  72. })
  73. }
  74. func TestUserBindCache(t *testing.T) {
  75. Convey("UserBindCache", t, func() {
  76. res, err := d.UserBindCache(ctx(), 1)
  77. So(err, ShouldBeNil)
  78. So(res, ShouldNotBeEmpty)
  79. })
  80. }
  81. func TestAddUserBindCache(t *testing.T) {
  82. Convey("AddUserBindCache", t, func() {
  83. err := d.AddUserBindCache(ctx(), 1, nil)
  84. So(err, ShouldBeNil)
  85. })
  86. }
  87. func TestDeleteUserPackReceiveCache(t *testing.T) {
  88. Convey("DeleteUserPackReceiveCache", t, func() {
  89. err := d.DeleteUserPackReceiveCache(ctx(), 1)
  90. So(err, ShouldBeNil)
  91. })
  92. }