property_review_test.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/service/main/member/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoAddUserMonitor(t *testing.T) {
  9. var (
  10. c = context.TODO()
  11. mid = int64(1)
  12. operator = "zhoujiahui"
  13. remark = "test"
  14. )
  15. convey.Convey("AddUserMonitor", t, func(ctx convey.C) {
  16. p1 := d.AddUserMonitor(c, mid, operator, remark)
  17. ctx.Convey("Error should be nil", func(ctx convey.C) {
  18. ctx.So(p1, convey.ShouldBeNil)
  19. })
  20. })
  21. }
  22. func TestDaoIsInUserMonitor(t *testing.T) {
  23. var (
  24. c = context.TODO()
  25. mid = int64(1)
  26. )
  27. convey.Convey("IsInUserMonitor", t, func(ctx convey.C) {
  28. p1, p2 := d.IsInUserMonitor(c, mid)
  29. ctx.Convey("Error should be nil", func(ctx convey.C) {
  30. ctx.So(p2, convey.ShouldBeNil)
  31. })
  32. ctx.Convey("p1 should not be nil", func(ctx convey.C) {
  33. ctx.So(p1, convey.ShouldNotBeNil)
  34. })
  35. })
  36. }
  37. func TestDaoAddPropertyReview(t *testing.T) {
  38. var (
  39. c = context.TODO()
  40. r = &model.UserPropertyReview{
  41. Mid: 2231365,
  42. Old: "hahhah",
  43. New: "dangerou",
  44. State: model.ReviewStateWait,
  45. Property: model.ReviewPropertySign,
  46. IsMonitor: true,
  47. Extra: "{}",
  48. }
  49. )
  50. convey.Convey("AddPropertyReview", t, func(ctx convey.C) {
  51. p1 := d.AddPropertyReview(c, r)
  52. ctx.Convey("Error should be nil", func(ctx convey.C) {
  53. ctx.So(p1, convey.ShouldBeNil)
  54. })
  55. })
  56. }
  57. func TestDaoArchivePropertyReview(t *testing.T) {
  58. var (
  59. c = context.TODO()
  60. mid = int64(3)
  61. property = int8(1)
  62. )
  63. convey.Convey("ArchivePropertyReview", t, func(ctx convey.C) {
  64. p1 := d.ArchivePropertyReview(c, mid, property)
  65. ctx.Convey("Error should be nil", func(ctx convey.C) {
  66. ctx.So(p1, convey.ShouldBeNil)
  67. })
  68. })
  69. }