panel_test.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/app/admin/main/vip/model"
  6. xtime "go-common/library/time"
  7. "testing"
  8. "time"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. func TestServiceVipPriceConfigs(t *testing.T) {
  12. Convey("Test_VipPriceConfigs", t, func() {
  13. av := &model.ArgVipPrice{
  14. Plat: 1,
  15. Month: 1,
  16. SubType: 1,
  17. SuitType: 1,
  18. }
  19. res, err := s.VipPriceConfigs(context.TODO(), av)
  20. So(err, ShouldBeNil)
  21. So(res, ShouldNotBeNil)
  22. })
  23. }
  24. func TestServiceVipPriceConfigID(t *testing.T) {
  25. Convey("Test_VipPriceConfigID", t, func() {
  26. res, err := s.VipPriceConfigID(context.TODO(), &model.ArgVipPriceID{ID: 1})
  27. So(err, ShouldBeNil)
  28. So(res, ShouldNotBeNil)
  29. })
  30. }
  31. func TestServiceAddVipPriceConfig(t *testing.T) {
  32. Convey("Test_AddVipPriceConfig", t, func() {
  33. aavpc := &model.ArgAddOrUpVipPrice{
  34. Plat: 1,
  35. PdName: "xxx",
  36. PdID: "xxx",
  37. Month: 1,
  38. SubType: 1,
  39. SuitType: 0,
  40. OPrice: 1,
  41. }
  42. err := s.AddVipPriceConfig(context.TODO(), aavpc)
  43. So(err, ShouldBeNil)
  44. })
  45. }
  46. func TestServiceUpVipPriceConfig(t *testing.T) {
  47. Convey("Test_UpVipPriceConfig", t, func() {
  48. aavpc := &model.ArgAddOrUpVipPrice{
  49. ID: 235,
  50. Plat: 1,
  51. PdName: "xxx",
  52. PdID: "xxx",
  53. Month: 1,
  54. SubType: 1,
  55. SuitType: 1,
  56. OPrice: 1,
  57. StartBuild: 0,
  58. EndBuild: 103,
  59. }
  60. err := s.UpVipPriceConfig(context.TODO(), aavpc)
  61. So(err, ShouldBeNil)
  62. })
  63. }
  64. func TestServiceDelVipPriceConfig(t *testing.T) {
  65. advp := &model.ArgVipPriceID{ID: 1}
  66. Convey("Test_DelVipPriceConfig", t, func() {
  67. err := s.DelVipPriceConfig(context.TODO(), advp)
  68. So(err, ShouldBeNil)
  69. })
  70. }
  71. func TestServiceVipDPriceConfigs(t *testing.T) {
  72. Convey("Test_VipDPriceConfigs", t, func() {
  73. av := &model.ArgVipPriceID{
  74. ID: 155,
  75. }
  76. res, err := s.VipDPriceConfigs(context.TODO(), av)
  77. fmt.Println("res", res)
  78. So(err, ShouldBeNil)
  79. So(res, ShouldNotBeNil)
  80. })
  81. }
  82. func TestServiceVipDPriceConfigID(t *testing.T) {
  83. Convey("Test_VipDPriceConfigID", t, func() {
  84. res, err := s.VipDPriceConfigID(context.TODO(), &model.ArgVipDPriceID{DisID: 10})
  85. fmt.Println("res", res.FirstPrice)
  86. So(err, ShouldBeNil)
  87. So(res, ShouldNotBeNil)
  88. })
  89. }
  90. func TestServiceAddVipDPriceConfig(t *testing.T) {
  91. Convey("Test_AddVipDPriceConfig", t, func() {
  92. aavpc := &model.ArgAddOrUpVipDPrice{
  93. DisID: 1,
  94. ID: 155,
  95. PdID: "tv.danmaku.bilianimexAuto3VIP",
  96. DPrice: 15,
  97. STime: xtime.Time(time.Now().Unix()) + 100000000000,
  98. ETime: xtime.Time(time.Now().Unix()) + 200000000000,
  99. Remark: "test2",
  100. Operator: "admin",
  101. OpID: 11,
  102. FirstPrice: 13,
  103. }
  104. err := s.AddVipDPriceConfig(context.TODO(), aavpc)
  105. So(err, ShouldBeNil)
  106. })
  107. }
  108. func TestServiceUpVipDPriceConfig(t *testing.T) {
  109. Convey("Test_UpVipDPriceConfig", t, func() {
  110. aavpc := &model.ArgAddOrUpVipDPrice{
  111. DisID: 11,
  112. ID: 155,
  113. PdID: "tv.danmaku.bilianimexAuto3VIP",
  114. DPrice: 1.1,
  115. STime: xtime.Time(time.Now().Unix()) + 100000000000,
  116. ETime: xtime.Time(time.Now().Unix()) + 200000000000,
  117. Remark: "test2",
  118. Operator: "admin",
  119. OpID: 11,
  120. FirstPrice: 11,
  121. }
  122. err := s.UpVipDPriceConfig(context.TODO(), aavpc)
  123. So(err, ShouldBeNil)
  124. })
  125. }
  126. func TestServiceDelVipDPriceConfig(t *testing.T) {
  127. advp := &model.ArgVipDPriceID{DisID: 1}
  128. Convey("Test_DelVipDPriceConfig", t, func() {
  129. err := s.DelVipDPriceConfig(context.TODO(), advp)
  130. So(err, ShouldBeNil)
  131. })
  132. }