face_history_test.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. package dao
  2. import (
  3. xtime "go-common/library/time"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. "github.com/tsuna/gohbase/hrpc"
  7. )
  8. func TestDaoreverse(t *testing.T) {
  9. convey.Convey("reverse", t, func(ctx convey.C) {
  10. var (
  11. s = "123"
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. p1 := reverse(s)
  15. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  16. ctx.So(p1, convey.ShouldEqual, "321")
  17. })
  18. })
  19. })
  20. }
  21. func TestDaorpad(t *testing.T) {
  22. convey.Convey("rpad", t, func(ctx convey.C) {
  23. var (
  24. s = "123"
  25. c = "a"
  26. l = int(4)
  27. )
  28. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  29. p1 := rpad(s, c, l)
  30. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  31. ctx.So(p1, convey.ShouldEqual, "123a")
  32. })
  33. })
  34. })
  35. }
  36. func TestDaomidKey(t *testing.T) {
  37. convey.Convey("midKey", t, func(ctx convey.C) {
  38. var (
  39. mid = int64(1)
  40. time xtime.Time
  41. )
  42. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  43. p1 := midKey(mid, time)
  44. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  45. ctx.So(p1, convey.ShouldNotBeNil)
  46. })
  47. })
  48. })
  49. }
  50. func TestDaooperatorKey(t *testing.T) {
  51. convey.Convey("operatorKey", t, func(ctx convey.C) {
  52. var (
  53. operator = "admin"
  54. time xtime.Time
  55. )
  56. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  57. p1 := operatorKey(operator, time)
  58. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  59. ctx.So(p1, convey.ShouldNotBeNil)
  60. })
  61. })
  62. })
  63. }
  64. func TestDaoscanTimes(t *testing.T) {
  65. convey.Convey("scanTimes", t, func(ctx convey.C) {
  66. var (
  67. tDuration xtime.Time
  68. )
  69. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  70. p1 := scanTimes(tDuration)
  71. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  72. ctx.So(p1, convey.ShouldNotBeNil)
  73. })
  74. })
  75. })
  76. }
  77. func TestDaoFaceHistoryByMid(t *testing.T) {
  78. convey.Convey("FaceHistoryByMid", t, func(ctx convey.C) {
  79. // var (
  80. // c = context.Background()
  81. // arg = &model.ArgFaceHistory{}
  82. // )
  83. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  84. // p1, err := d.FaceHistoryByMid(c, arg)
  85. // ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  86. // ctx.So(err, convey.ShouldBeNil)
  87. // ctx.So(p1, convey.ShouldNotBeNil)
  88. // })
  89. })
  90. })
  91. }
  92. func TestDaoFaceHistoryByOP(t *testing.T) {
  93. convey.Convey("FaceHistoryByOP", t, func(ctx convey.C) {
  94. // var (
  95. // c = context.Background()
  96. // arg = &model.ArgFaceHistory{}
  97. // )
  98. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  99. // p1, err := d.FaceHistoryByOP(c, arg)
  100. // ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  101. // ctx.So(err, convey.ShouldBeNil)
  102. // ctx.So(p1, convey.ShouldNotBeNil)
  103. // })
  104. })
  105. })
  106. }
  107. func TestDaotoOPFaceRecord(t *testing.T) {
  108. convey.Convey("toOPFaceRecord", t, func(ctx convey.C) {
  109. var (
  110. res = &hrpc.Result{}
  111. )
  112. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  113. p1 := toOPFaceRecord(res)
  114. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  115. ctx.So(p1, convey.ShouldNotBeNil)
  116. })
  117. })
  118. })
  119. }
  120. func TestDaotoMidFaceRecord(t *testing.T) {
  121. convey.Convey("toMidFaceRecord", t, func(ctx convey.C) {
  122. var (
  123. res = &hrpc.Result{}
  124. )
  125. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  126. p1 := toMidFaceRecord(res)
  127. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  128. ctx.So(p1, convey.ShouldNotBeNil)
  129. })
  130. })
  131. })
  132. }