member_test.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "time"
  7. "go-common/app/admin/main/member/model"
  8. "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestBase(t *testing.T) {
  11. convey.Convey("Base", t, func() {
  12. base, err := d.Base(context.Background(), 123)
  13. convey.So(err, convey.ShouldBeNil)
  14. convey.So(base, convey.ShouldNotBeNil)
  15. })
  16. }
  17. func TestExp(t *testing.T) {
  18. convey.Convey("Exp", t, func() {
  19. exp, err := d.Exp(context.Background(), 123)
  20. convey.So(err, convey.ShouldBeNil)
  21. convey.So(exp, convey.ShouldNotBeNil)
  22. })
  23. }
  24. func TestMoral(t *testing.T) {
  25. convey.Convey("Moral", t, func() {
  26. moral, err := d.Moral(context.Background(), 123)
  27. convey.So(err, convey.ShouldBeNil)
  28. convey.So(moral, convey.ShouldNotBeNil)
  29. })
  30. }
  31. func TestDao_BatchUserAddit(t *testing.T) {
  32. convey.Convey("BatchUserAddit", t, func() {
  33. userAddits, err := d.BatchUserAddit(context.Background(), []int64{5, 13, 3})
  34. convey.So(err, convey.ShouldBeNil)
  35. convey.So(userAddits, convey.ShouldNotBeNil)
  36. })
  37. }
  38. func TestDao_UpName(t *testing.T) {
  39. convey.Convey("UpName", t, func() {
  40. name := fmt.Sprintf("100_Bili_%v", time.Now().Unix())
  41. err := d.UpName(context.Background(), 100, name)
  42. convey.So(err, convey.ShouldBeNil)
  43. })
  44. }
  45. func TestDao_UpSign(t *testing.T) {
  46. convey.Convey("UpSign", t, func() {
  47. sign := fmt.Sprintf("签名%v", time.Now().Unix())
  48. err := d.UpSign(context.Background(), 100, sign)
  49. convey.So(err, convey.ShouldBeNil)
  50. })
  51. }
  52. func TestDao_UpFace(t *testing.T) {
  53. convey.Convey("UpFace", t, func() {
  54. face := fmt.Sprintf("testFace%v.jpg", time.Now().Unix())
  55. err := d.UpFace(context.Background(), 100, face)
  56. convey.So(err, convey.ShouldBeNil)
  57. })
  58. }
  59. func TestDao_PubExpMsg(t *testing.T) {
  60. convey.Convey("PubExpMsg", t, func() {
  61. msg := &model.AddExpMsg{
  62. Mid: 1,
  63. IP: "127.0.0.1",
  64. Ts: time.Now().Unix(),
  65. Event: "test",
  66. }
  67. err := d.PubExpMsg(context.Background(), msg)
  68. convey.So(err, convey.ShouldBeNil)
  69. })
  70. }
  71. func TestDao_UserAddit(t *testing.T) {
  72. convey.Convey("UserAddit", t, func() {
  73. userAddit, err := d.UserAddit(context.Background(), 5)
  74. convey.So(err, convey.ShouldBeNil)
  75. convey.So(userAddit, convey.ShouldNotBeNil)
  76. })
  77. }
  78. func TestDao_UpAdditRemark(t *testing.T) {
  79. convey.Convey("UpAdditRemark", t, func() {
  80. remark := fmt.Sprintf("remark%v", time.Now().Unix())
  81. err := d.UpAdditRemark(context.Background(), 27515431, remark)
  82. convey.So(err, convey.ShouldBeNil)
  83. })
  84. }