mysql_test.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. package medal
  2. import (
  3. "testing"
  4. "time"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestMedalhit(t *testing.T) {
  8. convey.Convey("hit", t, func(ctx convey.C) {
  9. var (
  10. id = int64(0)
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. p1 := d.hit(id)
  14. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  15. ctx.So(p1, convey.ShouldNotBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestMedalAddMedalOwner(t *testing.T) {
  21. convey.Convey("AddMedalOwner", t, func(ctx convey.C) {
  22. var (
  23. mid = time.Now().Unix()
  24. nid = int64(5)
  25. )
  26. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  27. err := d.AddMedalOwner(c, mid, nid)
  28. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. })
  31. })
  32. })
  33. }
  34. func TestMedalInstallMedalOwner(t *testing.T) {
  35. convey.Convey("InstallMedalOwner", t, func(ctx convey.C) {
  36. var (
  37. mid = int64(0)
  38. nid = int64(0)
  39. )
  40. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  41. err := d.InstallMedalOwner(c, mid, nid)
  42. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. })
  45. })
  46. })
  47. }
  48. func TestMedalUninstallMedalOwner(t *testing.T) {
  49. convey.Convey("UninstallMedalOwner", t, func(ctx convey.C) {
  50. var (
  51. mid = int64(0)
  52. nid = int64(0)
  53. )
  54. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  55. err := d.UninstallMedalOwner(c, mid, nid)
  56. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  57. ctx.So(err, convey.ShouldBeNil)
  58. })
  59. })
  60. })
  61. }
  62. func TestMedalUninstallAllMedalOwner(t *testing.T) {
  63. convey.Convey("UninstallAllMedalOwner", t, func(ctx convey.C) {
  64. var (
  65. mid = int64(0)
  66. nid = int64(0)
  67. )
  68. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  69. err := d.UninstallAllMedalOwner(c, mid, nid)
  70. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  71. ctx.So(err, convey.ShouldBeNil)
  72. })
  73. })
  74. })
  75. }
  76. func TestMedalMedalInfoAll(t *testing.T) {
  77. convey.Convey("MedalInfoAll", t, func(ctx convey.C) {
  78. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  79. res, err := d.MedalInfoAll(c)
  80. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  81. ctx.So(err, convey.ShouldBeNil)
  82. ctx.So(res, convey.ShouldNotBeNil)
  83. })
  84. })
  85. })
  86. }
  87. func TestMedalMedalOwnerByMid(t *testing.T) {
  88. convey.Convey("MedalOwnerByMid", t, func(ctx convey.C) {
  89. var (
  90. mid = int64(0)
  91. )
  92. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  93. res, err := d.MedalOwnerByMid(c, mid)
  94. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  95. ctx.So(err, convey.ShouldBeNil)
  96. ctx.So(res, convey.ShouldNotBeNil)
  97. })
  98. })
  99. })
  100. }
  101. func TestMedalMedalInfoByNid(t *testing.T) {
  102. convey.Convey("MedalInfoByNid", t, func(ctx convey.C) {
  103. var (
  104. nid = int64(0)
  105. )
  106. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  107. res, err := d.MedalInfoByNid(c, nid)
  108. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  109. ctx.So(err, convey.ShouldBeNil)
  110. ctx.So(res, convey.ShouldNotBeNil)
  111. })
  112. })
  113. })
  114. }
  115. func TestMedalActivatedOwnerByMid(t *testing.T) {
  116. convey.Convey("ActivatedOwnerByMid", t, func(ctx convey.C) {
  117. var (
  118. mid = int64(0)
  119. )
  120. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  121. nid, err := d.ActivatedOwnerByMid(c, mid)
  122. ctx.Convey("Then err should be nil.nid should not be nil.", func(ctx convey.C) {
  123. ctx.So(err, convey.ShouldBeNil)
  124. ctx.So(nid, convey.ShouldNotBeNil)
  125. })
  126. })
  127. })
  128. }
  129. func TestMedalCountOwnerBYNidMid(t *testing.T) {
  130. convey.Convey("CountOwnerBYNidMid", t, func(ctx convey.C) {
  131. var (
  132. mid = int64(0)
  133. nid = int64(0)
  134. )
  135. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  136. count, err := d.CountOwnerBYNidMid(c, mid, nid)
  137. ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
  138. ctx.So(err, convey.ShouldBeNil)
  139. ctx.So(count, convey.ShouldNotBeNil)
  140. })
  141. })
  142. })
  143. }
  144. func TestMedalOwnerBYNidMid(t *testing.T) {
  145. convey.Convey("OwnerBYNidMid", t, func(ctx convey.C) {
  146. var (
  147. mid = int64(32141)
  148. nid = int64(1)
  149. )
  150. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  151. res, err := d.OwnerBYNidMid(c, mid, nid)
  152. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  153. ctx.So(err, convey.ShouldBeNil)
  154. ctx.So(res, convey.ShouldNotBeNil)
  155. })
  156. })
  157. })
  158. }
  159. func TestMedalMedalGroupAll(t *testing.T) {
  160. convey.Convey("MedalGroupAll", t, func(ctx convey.C) {
  161. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  162. res, err := d.MedalGroupAll(c)
  163. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  164. ctx.So(err, convey.ShouldBeNil)
  165. ctx.So(res, convey.ShouldNotBeNil)
  166. })
  167. })
  168. })
  169. }