advance_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package client
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "go-common/app/interface/main/dm2/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestBuyAdvance(t *testing.T) {
  10. var (
  11. mid int64 = 27515260
  12. cid int64 = 10107292
  13. mode = "sp"
  14. )
  15. Convey("test buy advance dm", t, func() {
  16. arg := &model.ArgAdvance{
  17. Mid: mid,
  18. Cid: cid,
  19. Mode: mode,
  20. }
  21. err := svr.BuyAdvance(context.TODO(), arg)
  22. fmt.Println(err)
  23. So(err, ShouldBeNil)
  24. })
  25. }
  26. func TestAdvanceState(t *testing.T) {
  27. var (
  28. mid int64 = 27515330
  29. cid int64 = 10107292
  30. mode = "sp"
  31. )
  32. Convey("test advance dm state", t, func() {
  33. arg := &model.ArgAdvance{
  34. Mid: mid,
  35. Cid: cid,
  36. Mode: mode,
  37. }
  38. res, err := svr.AdvanceState(context.TODO(), arg)
  39. So(err, ShouldBeNil)
  40. So(res, ShouldNotBeEmpty)
  41. })
  42. }
  43. func TestAdvances(t *testing.T) {
  44. var (
  45. mid int64 = 27515260
  46. )
  47. Convey("test dm advances", t, func() {
  48. arg := &model.ArgMid{Mid: mid}
  49. res, err := svr.Advances(context.TODO(), arg)
  50. So(err, ShouldBeNil)
  51. So(res, ShouldNotBeEmpty)
  52. })
  53. }
  54. func TestPassAdvance(t *testing.T) {
  55. var (
  56. mid int64 = 7158471
  57. id int64 = 2
  58. )
  59. Convey("test pass advance dm", t, func() {
  60. arg := &model.ArgUpAdvance{Mid: mid, ID: id}
  61. err := svr.PassAdvance(context.TODO(), arg)
  62. So(err, ShouldBeNil)
  63. })
  64. }
  65. func TestDenyAdvance(t *testing.T) {
  66. var (
  67. mid int64 = 27515615
  68. id int64 = 107
  69. )
  70. Convey("test deny advance dm", t, func() {
  71. arg := &model.ArgUpAdvance{Mid: mid, ID: id}
  72. err := svr.DenyAdvance(context.TODO(), arg)
  73. So(err, ShouldBeNil)
  74. })
  75. }
  76. func TestCancelAdvance(t *testing.T) {
  77. var (
  78. mid int64 = 27515615
  79. id int64 = 107
  80. )
  81. Convey("test cancel advance dm", t, func() {
  82. arg := &model.ArgUpAdvance{Mid: mid, ID: id}
  83. err := svr.CancelAdvance(context.TODO(), arg)
  84. So(err, ShouldBeNil)
  85. })
  86. }